diff options
author | Jisheng Zhang <jszhang@marvell.com> | 2015-01-28 06:54:12 -0500 |
---|---|---|
committer | Ulf Hansson <ulf.hansson@linaro.org> | 2015-01-29 05:10:11 -0500 |
commit | 14460dbaf7a5a0488963fdb8232ad5c8a8cca7b7 (patch) | |
tree | 9c6c04d64ba6350550e5e0e4afcc1cf8f535b795 | |
parent | 9608337945a658956b1b871347963d56e246b815 (diff) |
mmc: sdhci-pxav3: fix setting of pdata->clk_delay_cycles
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>
Cc: <stable@vger.kernel.org> # v3.6+
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
-rw-r--r-- | drivers/mmc/host/sdhci-pxav3.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/mmc/host/sdhci-pxav3.c b/drivers/mmc/host/sdhci-pxav3.c index c5db5d271ee7..f1c6362648c1 100644 --- a/drivers/mmc/host/sdhci-pxav3.c +++ b/drivers/mmc/host/sdhci-pxav3.c | |||
@@ -268,8 +268,8 @@ static struct sdhci_pxa_platdata *pxav3_get_mmc_pdata(struct device *dev) | |||
268 | if (!pdata) | 268 | if (!pdata) |
269 | return NULL; | 269 | return NULL; |
270 | 270 | ||
271 | of_property_read_u32(np, "mrvl,clk-delay-cycles", &clk_delay_cycles); | 271 | if (!of_property_read_u32(np, "mrvl,clk-delay-cycles", |
272 | if (clk_delay_cycles > 0) | 272 | &clk_delay_cycles)) |
273 | pdata->clk_delay_cycles = clk_delay_cycles; | 273 | pdata->clk_delay_cycles = clk_delay_cycles; |
274 | 274 | ||
275 | return pdata; | 275 | return pdata; |