Message ID | CAHFnbAnWCrTQ8hozx9zGy0EjTKGPCudF3Pw3zP5ZfJGtG+yNHw@mail.gmail.com |
---|---|
State | Superseded, archived |
Delegated to: | Andy Fleming |
Headers | show |
Hi Jongman, On Mon, Jun 4, 2012 at 3:32 PM, Jongman Heo <jongman.heo@gmail.com> wrote: > (!timeout) condition check in mmc_send_status() can never be met, > because do-while loop ends up with negative timeout value, -1. > > Fix it by using pre-decrement. > > Signed-off-by: Jongman Heo <jongman.heo@gmail.com> > --- > drivers/mmc/mmc.c | 2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) > > diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c > index aebe578..de19d4e 100644 > --- a/drivers/mmc/mmc.c > +++ b/drivers/mmc/mmc.c > @@ -232,7 +232,7 @@ int mmc_send_status(struct mmc *mmc, int timeout) > > udelay(1000); > > - } while (timeout--); > + } while (--timeout); > > #ifdef CONFIG_MMC_TRACE > status = (cmd.response[0] & MMC_STATUS_CURR_STATE) >> 9; Changing if (!timeout) to if(timeout <=0) would be more consistent with other usage in mmc.c Regards, Graeme
diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c index aebe578..de19d4e 100644 --- a/drivers/mmc/mmc.c +++ b/drivers/mmc/mmc.c @@ -232,7 +232,7 @@ int mmc_send_status(struct mmc *mmc, int timeout) udelay(1000); - } while (timeout--); + } while (--timeout); #ifdef CONFIG_MMC_TRACE status = (cmd.response[0] & MMC_STATUS_CURR_STATE) >> 9;
(!timeout) condition check in mmc_send_status() can never be met, because do-while loop ends up with negative timeout value, -1. Fix it by using pre-decrement. Signed-off-by: Jongman Heo <jongman.heo@gmail.com> --- drivers/mmc/mmc.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)