mmc: avoid garbage when dt properties missing
Subsystems (3)
PATCH 1/1 mmc: avoid garbage when dt properties missing
When of_property_read_u32 does not find a property, it does not initialise the variable, yet we were using the uninitialised variable.
Found and reproduced in sdhci-pxav3.c, on wider review found also in two other places in drivers/mmc/host/, did not review wider.
Signed-off-by James Cameron <[email protected]>
--- drivers/mmc/host/omap_hsmmc.c | 2 +- drivers/mmc/host/sdhci-pxav2.c | 4 ++-- drivers/mmc/host/sdhci-pxav3.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-)
drivers/mmc/host/omap_hsmmc.c +1 -1
@@ -1784,7 +1784,7 @@ static struct omap_mmc_platform_data *of_get_hsmmc_pdata(struct device *dev) {struct omap_mmc_platform_data *pdata;struct device_node *np = dev->of_node; -u32 bus_width, max_freq; +u32 bus_width =0 , max_freq;int cd_gpio, wp_gpio; cd_gpio =of_get_named_gpio (np,"cd-gpios" ,0 );
drivers/mmc/host/sdhci-pxav2.c +2 -2
@@ -130,8 +130,8 @@ static struct sdhci_pxa_platdata *pxav2_get_mmc_pdata(struct device *dev) {struct sdhci_pxa_platdata *pdata;struct device_node *np = dev->of_node; -u32 bus_width; -u32 clk_delay_cycles; +u32 bus_width =0 ; +u32 clk_delay_cycles =0 ; pdata =devm_kzalloc (dev,sizeof (*pdata),GFP_KERNEL );if (!pdata)
drivers/mmc/host/sdhci-pxav3.c +1 -1
@@ -253,7 +253,7 @@ static struct sdhci_pxa_platdata *pxav3_get_mmc_pdata(struct device *dev) {struct sdhci_pxa_platdata *pdata;struct device_node *np = dev->of_node; -u32 clk_delay_cycles; +u32 clk_delay_cycles =0 ; pdata =devm_kzalloc (dev,sizeof (*pdata),GFP_KERNEL );if (!pdata)
Signature · 6 lines
1.8.3.2 -- James Cameron http://quozl.linux.org.au/