public inbox for linux-mmc@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mmc: pwrseq_simple: fix error path in mmc_pwrseq_simple_alloc.
@ 2015-02-21  4:15 NeilBrown
  2015-02-23  8:27 ` Javier Martinez Canillas
  2015-03-05 14:56 ` Ulf Hansson
  0 siblings, 2 replies; 3+ messages in thread
From: NeilBrown @ 2015-02-21  4:15 UTC (permalink / raw)
  To: Ulf Hansson; +Cc: Javier Martinez Canillas, linux-mmc

[-- Attachment #1: Type: text/plain, Size: 827 bytes --]


From: NeilBrown <neil@brown.name>

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


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;

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 811 bytes --]

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] mmc: pwrseq_simple: fix error path in mmc_pwrseq_simple_alloc.
  2015-02-21  4:15 [PATCH] mmc: pwrseq_simple: fix error path in mmc_pwrseq_simple_alloc NeilBrown
@ 2015-02-23  8:27 ` Javier Martinez Canillas
  2015-03-05 14:56 ` Ulf Hansson
  1 sibling, 0 replies; 3+ messages in thread
From: Javier Martinez Canillas @ 2015-02-23  8:27 UTC (permalink / raw)
  To: NeilBrown, Ulf Hansson; +Cc: linux-mmc

Hello Neil,

On 02/21/2015 05:15 AM, NeilBrown wrote:
> 
> From: NeilBrown <neil@brown.name>
> 
> 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
> 
>

Right, sorry for the silly mistake.

Acked-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk>

Best regards,
Javier

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] mmc: pwrseq_simple: fix error path in mmc_pwrseq_simple_alloc.
  2015-02-21  4:15 [PATCH] mmc: pwrseq_simple: fix error path in mmc_pwrseq_simple_alloc NeilBrown
  2015-02-23  8:27 ` Javier Martinez Canillas
@ 2015-03-05 14:56 ` Ulf Hansson
  1 sibling, 0 replies; 3+ messages in thread
From: Ulf Hansson @ 2015-03-05 14:56 UTC (permalink / raw)
  To: NeilBrown; +Cc: Javier Martinez Canillas, linux-mmc

On 21 February 2015 at 05:15, NeilBrown <neilb@suse.de> wrote:
>
> From: NeilBrown <neil@brown.name>
>
> 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

Applied, thanks!

Kind regards
Uffe


>
>
> 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;

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-03-05 14:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-21  4:15 [PATCH] mmc: pwrseq_simple: fix error path in mmc_pwrseq_simple_alloc NeilBrown
2015-02-23  8:27 ` Javier Martinez Canillas
2015-03-05 14:56 ` Ulf Hansson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox