summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorNeilBrown <neil@brown.name>2015-02-21 07:15:16 +0300
committerUlf Hansson <ulf.hansson@linaro.org>2015-03-19 13:26:35 +0300
commit6b7a783ebd2181aa2e0e6f9f5509da8466e321e3 (patch)
tree6c360e11c15c73fa8ebb50446b7e95589a7cabfe /drivers
parent06e5801b8cb3fc057d88cb4dc03c0b64b2744cda (diff)
downloadlinux-6b7a783ebd2181aa2e0e6f9f5509da8466e321e3.tar.xz
mmc: pwrseq_simple: fix error path in mmc_pwrseq_simple_alloc
The current error-path code (when gpiod_get_index() reports an error) can never free pwrseq->reset_gpios[0], but might try to tree pwrseq->reset_gpios[-1], which has unfortunate consequences. Signed-off-by: NeilBrown <neil@brown.name> Fixes: 934f1f48330ed695927a51fa068dc5d673f2da19 Acked-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Reported-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/mmc/core/pwrseq_simple.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/mmc/core/pwrseq_simple.c b/drivers/mmc/core/pwrseq_simple.c
index e9f1d8d84613..c53f14a7ce54 100644
--- a/drivers/mmc/core/pwrseq_simple.c
+++ b/drivers/mmc/core/pwrseq_simple.c
@@ -124,7 +124,7 @@ int mmc_pwrseq_simple_alloc(struct mmc_host *host, struct device *dev)
PTR_ERR(pwrseq->reset_gpios[i]) != -ENOSYS) {
ret = PTR_ERR(pwrseq->reset_gpios[i]);
- while (--i)
+ while (i--)
gpiod_put(pwrseq->reset_gpios[i]);
goto clk_put;