summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorJisheng Zhang <jszhang@marvell.com>2015-01-28 19:54:12 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2015-03-06 14:52:52 -0800
commitdd553502d83c37f57c2f7fcfa1d5f3d32a044ef0 (patch)
tree8a106841e7d4c9df4f77a9c5c076821017fd001b /drivers
parent4d025d8000898c8e14bbf9a793063aadae31045b (diff)
mmc: sdhci-pxav3: fix setting of pdata->clk_delay_cycles
commit 14460dbaf7a5a0488963fdb8232ad5c8a8cca7b7 upstream. Current code checks "clk_delay_cycles > 0" to know whether the optional "mrvl,clk_delay_cycles" is set or not. But of_property_read_u32() doesn't touch clk_delay_cycles if the property is not set. And type of clk_delay_cycles is u32, so we may always set pdata->clk_delay_cycles as a random value. This patch fix this problem by check the return value of of_property_read_u32() to know whether the optional clk-delay-cycles is set or not. Signed-off-by: Jisheng Zhang <jszhang@marvell.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/mmc/host/sdhci-pxav3.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/mmc/host/sdhci-pxav3.c b/drivers/mmc/host/sdhci-pxav3.c
index bb50da1cab98..1d74dc90d8cb 100644
--- a/drivers/mmc/host/sdhci-pxav3.c
+++ b/drivers/mmc/host/sdhci-pxav3.c
@@ -261,8 +261,8 @@ static struct sdhci_pxa_platdata *pxav3_get_mmc_pdata(struct device *dev)
if (!pdata)
return NULL;
- of_property_read_u32(np, "mrvl,clk-delay-cycles", &clk_delay_cycles);
- if (clk_delay_cycles > 0)
+ if (!of_property_read_u32(np, "mrvl,clk-delay-cycles",
+ &clk_delay_cycles))
pdata->clk_delay_cycles = clk_delay_cycles;
return pdata;