mmc: sdhci-s3c: fix potential NULL dereference
authorJaehoon Chung <jh80.chung@samsung.com>
Wed, 12 Oct 2011 04:14:29 +0000 (13:14 +0900)
committerChris Ball <cjb@laptop.org>
Wed, 26 Oct 2011 20:32:22 +0000 (16:32 -0400)
sc->clk_bus[ptr] could be NULL.

Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
drivers/mmc/host/sdhci-s3c.c

index 82709b6..3d00e72 100644 (file)
@@ -567,8 +567,10 @@ static int __devinit sdhci_s3c_probe(struct platform_device *pdev)
 
  err_req_regs:
        for (ptr = 0; ptr < MAX_BUS_CLK; ptr++) {
-               clk_disable(sc->clk_bus[ptr]);
-               clk_put(sc->clk_bus[ptr]);
+               if (sc->clk_bus[ptr]) {
+                       clk_disable(sc->clk_bus[ptr]);
+                       clk_put(sc->clk_bus[ptr]);
+               }
        }
 
  err_no_busclks: