mmc: pwrseq_simple: fix error path in mmc_pwrseq_simple_alloc.
PATCH 1/1 mmc: pwrseq_simple: fix error path in mmc_pwrseq_simple_alloc.
From: NeilBrown <[email protected]>
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.
drivers/mmc/core/pwrseq_simple.c +1 -1
@@ -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;
Hello Neil,
Quoted 12 lines · NeilBrown
From: NeilBrown <[email protected]>
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 <[email protected]>Fixes 934f1f48330ed695927a51fa068dc5d673f2da19
Right, sorry for the silly mistake.
Best regards,
Javier
Ulf Hansson
AppliedQuoted 10 lines · NeilBrown
From: NeilBrown <[email protected]>
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 <[email protected]>Fixes 934f1f48330ed695927a51fa068dc5d673f2da19
Applied, thanks!
Kind regards
Uffe
Quoted 15 lines
drivers/mmc/core/pwrseq_simple.c +1
-1@@ -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;