Skip to content

Commit

Permalink
mmc: pwrseq_simple: fix error path in mmc_pwrseq_simple_alloc
Browse files Browse the repository at this point in the history
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: 934f1f4
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>
  • Loading branch information
NeilBrown authored and Ulf Hansson committed Mar 19, 2015
1 parent 06e5801 commit 6b7a783
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/mmc/core/pwrseq_simple.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 6b7a783

Please sign in to comment.