From: Marek Szyprowski Date: Thu, 23 Sep 2010 14:22:05 +0000 (+0200) Subject: mmc: sdhci-s3c: fix NULL ptr access in sdhci_s3c_remove X-Git-Tag: v3.0~3254^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9320f7cbbdd5febf013b0e91db29189724057738;p=platform%2Fkernel%2Flinux-amlogic.git mmc: sdhci-s3c: fix NULL ptr access in sdhci_s3c_remove If not all clocks have been defined in platform data, the driver will cause a null pointer dereference when it is removed. This patch fixes this issue. Signed-off-by: Marek Szyprowski Signed-off-by: Kyungmin Park Cc: Signed-off-by: Andrew Morton Signed-off-by: Chris Ball --- diff --git a/drivers/mmc/host/sdhci-s3c.c b/drivers/mmc/host/sdhci-s3c.c index 735d431..aacb862 100644 --- a/drivers/mmc/host/sdhci-s3c.c +++ b/drivers/mmc/host/sdhci-s3c.c @@ -483,8 +483,10 @@ static int __devexit sdhci_s3c_remove(struct platform_device *pdev) sdhci_remove_host(host, 1); for (ptr = 0; ptr < 3; 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]); + } } clk_disable(sc->clk_io); clk_put(sc->clk_io);