]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/2.6.35.8/mmc-sdhci-s3c-fix-null-ptr-access-in-sdhci_s3c_remove.patch
4.9-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 2.6.35.8 / mmc-sdhci-s3c-fix-null-ptr-access-in-sdhci_s3c_remove.patch
CommitLineData
8fbdb368
GKH
1From 9320f7cbbdd5febf013b0e91db29189724057738 Mon Sep 17 00:00:00 2001
2From: Marek Szyprowski <m.szyprowski@samsung.com>
3Date: Thu, 23 Sep 2010 16:22:05 +0200
4Subject: mmc: sdhci-s3c: fix NULL ptr access in sdhci_s3c_remove
5
6From: Marek Szyprowski <m.szyprowski@samsung.com>
7
8commit 9320f7cbbdd5febf013b0e91db29189724057738 upstream.
9
10If not all clocks have been defined in platform data, the driver will
11cause a null pointer dereference when it is removed. This patch fixes
12this issue.
13
14Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
15Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
16Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
17Signed-off-by: Chris Ball <cjb@laptop.org>
18Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
19
20---
21 drivers/mmc/host/sdhci-s3c.c | 6 ++++--
22 1 file changed, 4 insertions(+), 2 deletions(-)
23
24--- a/drivers/mmc/host/sdhci-s3c.c
25+++ b/drivers/mmc/host/sdhci-s3c.c
26@@ -372,8 +372,10 @@ static int __devexit sdhci_s3c_remove(st
27 sdhci_remove_host(host, 1);
28
29 for (ptr = 0; ptr < 3; ptr++) {
30- clk_disable(sc->clk_bus[ptr]);
31- clk_put(sc->clk_bus[ptr]);
32+ if (sc->clk_bus[ptr]) {
33+ clk_disable(sc->clk_bus[ptr]);
34+ clk_put(sc->clk_bus[ptr]);
35+ }
36 }
37 clk_disable(sc->clk_io);
38 clk_put(sc->clk_io);