diff options
author | Balaji T K <balajitk@ti.com> | 2012-10-15 12:05:08 -0400 |
---|---|---|
committer | Chris Ball <cjb@laptop.org> | 2012-11-07 15:01:54 -0500 |
commit | 9ea28ecbeb090159a3383ff60b29dee00c489774 (patch) | |
tree | 292d044d8c4f1fe9a7464b685debea36ceaf7e27 /drivers | |
parent | 9d1f02864408c20dbbfaa661231c7afb5a8fc028 (diff) |
mmc: omap_hsmmc: fix NULL pointer dereference for dt boot
dev->platform_data is NULL in case of device tree boot,
instead use the saved version in struct omap_hsmmc_host.
Signed-off-by: Balaji T K <balajitk@ti.com>
Signed-off-by: Venkatraman S <svenkatr@ti.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/mmc/host/omap_hsmmc.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c index d5057415d7d9..fedd258cc4ea 100644 --- a/drivers/mmc/host/omap_hsmmc.c +++ b/drivers/mmc/host/omap_hsmmc.c | |||
@@ -178,7 +178,8 @@ struct omap_hsmmc_host { | |||
178 | 178 | ||
179 | static int omap_hsmmc_card_detect(struct device *dev, int slot) | 179 | static int omap_hsmmc_card_detect(struct device *dev, int slot) |
180 | { | 180 | { |
181 | struct omap_mmc_platform_data *mmc = dev->platform_data; | 181 | struct omap_hsmmc_host *host = dev_get_drvdata(dev); |
182 | struct omap_mmc_platform_data *mmc = host->pdata; | ||
182 | 183 | ||
183 | /* NOTE: assumes card detect signal is active-low */ | 184 | /* NOTE: assumes card detect signal is active-low */ |
184 | return !gpio_get_value_cansleep(mmc->slots[0].switch_pin); | 185 | return !gpio_get_value_cansleep(mmc->slots[0].switch_pin); |
@@ -186,7 +187,8 @@ static int omap_hsmmc_card_detect(struct device *dev, int slot) | |||
186 | 187 | ||
187 | static int omap_hsmmc_get_wp(struct device *dev, int slot) | 188 | static int omap_hsmmc_get_wp(struct device *dev, int slot) |
188 | { | 189 | { |
189 | struct omap_mmc_platform_data *mmc = dev->platform_data; | 190 | struct omap_hsmmc_host *host = dev_get_drvdata(dev); |
191 | struct omap_mmc_platform_data *mmc = host->pdata; | ||
190 | 192 | ||
191 | /* NOTE: assumes write protect signal is active-high */ | 193 | /* NOTE: assumes write protect signal is active-high */ |
192 | return gpio_get_value_cansleep(mmc->slots[0].gpio_wp); | 194 | return gpio_get_value_cansleep(mmc->slots[0].gpio_wp); |
@@ -194,7 +196,8 @@ static int omap_hsmmc_get_wp(struct device *dev, int slot) | |||
194 | 196 | ||
195 | static int omap_hsmmc_get_cover_state(struct device *dev, int slot) | 197 | static int omap_hsmmc_get_cover_state(struct device *dev, int slot) |
196 | { | 198 | { |
197 | struct omap_mmc_platform_data *mmc = dev->platform_data; | 199 | struct omap_hsmmc_host *host = dev_get_drvdata(dev); |
200 | struct omap_mmc_platform_data *mmc = host->pdata; | ||
198 | 201 | ||
199 | /* NOTE: assumes card detect signal is active-low */ | 202 | /* NOTE: assumes card detect signal is active-low */ |
200 | return !gpio_get_value_cansleep(mmc->slots[0].switch_pin); | 203 | return !gpio_get_value_cansleep(mmc->slots[0].switch_pin); |
@@ -204,7 +207,8 @@ static int omap_hsmmc_get_cover_state(struct device *dev, int slot) | |||
204 | 207 | ||
205 | static int omap_hsmmc_suspend_cdirq(struct device *dev, int slot) | 208 | static int omap_hsmmc_suspend_cdirq(struct device *dev, int slot) |
206 | { | 209 | { |
207 | struct omap_mmc_platform_data *mmc = dev->platform_data; | 210 | struct omap_hsmmc_host *host = dev_get_drvdata(dev); |
211 | struct omap_mmc_platform_data *mmc = host->pdata; | ||
208 | 212 | ||
209 | disable_irq(mmc->slots[0].card_detect_irq); | 213 | disable_irq(mmc->slots[0].card_detect_irq); |
210 | return 0; | 214 | return 0; |
@@ -212,7 +216,8 @@ static int omap_hsmmc_suspend_cdirq(struct device *dev, int slot) | |||
212 | 216 | ||
213 | static int omap_hsmmc_resume_cdirq(struct device *dev, int slot) | 217 | static int omap_hsmmc_resume_cdirq(struct device *dev, int slot) |
214 | { | 218 | { |
215 | struct omap_mmc_platform_data *mmc = dev->platform_data; | 219 | struct omap_hsmmc_host *host = dev_get_drvdata(dev); |
220 | struct omap_mmc_platform_data *mmc = host->pdata; | ||
216 | 221 | ||
217 | enable_irq(mmc->slots[0].card_detect_irq); | 222 | enable_irq(mmc->slots[0].card_detect_irq); |
218 | return 0; | 223 | return 0; |
@@ -2009,9 +2014,9 @@ static int __devexit omap_hsmmc_remove(struct platform_device *pdev) | |||
2009 | clk_put(host->dbclk); | 2014 | clk_put(host->dbclk); |
2010 | } | 2015 | } |
2011 | 2016 | ||
2017 | omap_hsmmc_gpio_free(host->pdata); | ||
2012 | iounmap(host->base); | 2018 | iounmap(host->base); |
2013 | mmc_free_host(host->mmc); | 2019 | mmc_free_host(host->mmc); |
2014 | omap_hsmmc_gpio_free(pdev->dev.platform_data); | ||
2015 | 2020 | ||
2016 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 2021 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
2017 | if (res) | 2022 | if (res) |