aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc
diff options
context:
space:
mode:
authorMarek Szyprowski <m.szyprowski@samsung.com>2010-09-23 16:22:05 +0200
committerArve Hjønnevåg <arve@android.com>2011-11-17 17:51:43 -0800
commit943b013ac043ade8b5ad358b018a4bf5eb75d29a (patch)
treec20ad8c6dd3504363b1f9e4fd741f7a14e4c5637 /drivers/mmc
parent3f8dfd1f64d5a9c7a44263bb8b559526da67296c (diff)
downloadkernel_samsung_crespo-943b013ac043ade8b5ad358b018a4bf5eb75d29a.zip
kernel_samsung_crespo-943b013ac043ade8b5ad358b018a4bf5eb75d29a.tar.gz
kernel_samsung_crespo-943b013ac043ade8b5ad358b018a4bf5eb75d29a.tar.bz2
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 <m.szyprowski@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Cc: <stable@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Chris Ball <cjb@laptop.org> Change-Id: I72365e728b4ded3a850fecf5f138186cc1f1ffe2 Signed-off-by: Choi jonghwan <jhbird.choi@samsung.com>
Diffstat (limited to 'drivers/mmc')
-rwxr-xr-xdrivers/mmc/host/sdhci-s3c.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/mmc/host/sdhci-s3c.c b/drivers/mmc/host/sdhci-s3c.c
index 93be4d4..65a487b 100755
--- a/drivers/mmc/host/sdhci-s3c.c
+++ b/drivers/mmc/host/sdhci-s3c.c
@@ -608,8 +608,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:
@@ -645,7 +647,7 @@ static int __devexit sdhci_s3c_remove(struct platform_device *pdev)
sdhci_remove_host(host, 1);
- for (ptr = 0; ptr < 3; ptr++) {
+ for (ptr = 0; ptr < MAX_BUS_CLK; ptr++) {
if (sc->clk_bus[ptr]) {
clk_disable(sc->clk_bus[ptr]);
clk_put(sc->clk_bus[ptr]);