Skip to contentSkip to conversation

mmc: pwrseq_simple: fix error path in mmc_pwrseq_simple_alloc.

PATCH Applied NeilBrown 3 participants 3 messages Feb 21, 2015 – Mar 5, 2015 MMC, SD and SDIO

lore
Share & tools
lore

NeilBrown

author
#0 lore raw

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.

Fixes 934f1f48330ed695927a51fa068dc5d673f2da19
drivers/mmc/core/pwrseq_simple.c +1 -1
index e9f1d8d84613..c53f14a7ce54 100644
@@ -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;
Acked-by on v1 1/1
#1 lore raw

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.

Fixes 934f1f48330ed695927a51fa068dc5d673f2da19

Right, sorry for the silly mistake.

Best regards,
Javier

Applied
#2 lore raw
In reply to NeilBrown
Quoted 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.

Fixes 934f1f48330ed695927a51fa068dc5d673f2da19

Applied, thanks!

Kind regards
Uffe

Quoted 15 lines
drivers/mmc/core/pwrseq_simple.c +1 -1
index e9f1d8d84613..c53f14a7ce54 100644
@@ -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;