diff mbox

mmc: core: properly init drv_type

Message ID 20171130144910.4320-1-wsa+renesas@sang-engineering.com (mailing list archive)
State New, archived
Headers show

Commit Message

Wolfram Sang Nov. 30, 2017, 2:49 p.m. UTC
When the latest version of parsing the new eMMC bindings was moved from
core.c to mmc.c, it was overlooked that drv_type could be used
uninitialized. Fix it!

Fixes: 6186d06c519e21 ("mmc: parse new binding for eMMC fixed driver type")
Reported-by: Colin Ian King <colin.king@canonical.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
 drivers/mmc/core/mmc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Geert Uytterhoeven Dec. 4, 2017, 8:31 a.m. UTC | #1
Hi Wolfram,

On Thu, Nov 30, 2017 at 3:49 PM, Wolfram Sang
<wsa+renesas@sang-engineering.com> wrote:
> When the latest version of parsing the new eMMC bindings was moved from
> core.c to mmc.c, it was overlooked that drv_type could be used
> uninitialized. Fix it!
>
> Fixes: 6186d06c519e21 ("mmc: parse new binding for eMMC fixed driver type")
> Reported-by: Colin Ian King <colin.king@canonical.com>
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> ---
>  drivers/mmc/core/mmc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
> index a552f61060d212..0d1c6b025ca596 100644
> --- a/drivers/mmc/core/mmc.c
> +++ b/drivers/mmc/core/mmc.c
> @@ -1290,7 +1290,7 @@ int mmc_hs400_to_hs200(struct mmc_card *card)
>
>  static void mmc_select_driver_type(struct mmc_card *card)
>  {
> -       int card_drv_type, drive_strength, drv_type;
> +       int card_drv_type, drive_strength, drv_type = 0;
>         int fixed_drv_type = card->host->fixed_drv_type;
>
>         card_drv_type = card->ext_csd.raw_driver_strength |

Could this be the cause of the issues Simon was seeing, cfr. 'Possible
regression due to "arm64: renesas: salvator: set driver type for eMMC"'?

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Wolfram Sang Dec. 4, 2017, 8:50 a.m. UTC | #2
On Mon, Dec 04, 2017 at 09:31:13AM +0100, Geert Uytterhoeven wrote:
> Hi Wolfram,
> 
> On Thu, Nov 30, 2017 at 3:49 PM, Wolfram Sang
> <wsa+renesas@sang-engineering.com> wrote:
> > When the latest version of parsing the new eMMC bindings was moved from
> > core.c to mmc.c, it was overlooked that drv_type could be used
> > uninitialized. Fix it!
> >
> > Fixes: 6186d06c519e21 ("mmc: parse new binding for eMMC fixed driver type")
> > Reported-by: Colin Ian King <colin.king@canonical.com>
> > Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> > Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> > ---
> >  drivers/mmc/core/mmc.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
> > index a552f61060d212..0d1c6b025ca596 100644
> > --- a/drivers/mmc/core/mmc.c
> > +++ b/drivers/mmc/core/mmc.c
> > @@ -1290,7 +1290,7 @@ int mmc_hs400_to_hs200(struct mmc_card *card)
> >
> >  static void mmc_select_driver_type(struct mmc_card *card)
> >  {
> > -       int card_drv_type, drive_strength, drv_type;
> > +       int card_drv_type, drive_strength, drv_type = 0;
> >         int fixed_drv_type = card->host->fixed_drv_type;
> >
> >         card_drv_type = card->ext_csd.raw_driver_strength |
> 
> Could this be the cause of the issues Simon was seeing, cfr. 'Possible
> regression due to "arm64: renesas: salvator: set driver type for eMMC"'?

Yes, there is a chance. It still worked for me, though.
Simon Horman Dec. 4, 2017, 8:57 a.m. UTC | #3
On Mon, Dec 04, 2017 at 09:50:45AM +0100, Wolfram Sang wrote:
> On Mon, Dec 04, 2017 at 09:31:13AM +0100, Geert Uytterhoeven wrote:
> > Hi Wolfram,
> > 
> > On Thu, Nov 30, 2017 at 3:49 PM, Wolfram Sang
> > <wsa+renesas@sang-engineering.com> wrote:
> > > When the latest version of parsing the new eMMC bindings was moved from
> > > core.c to mmc.c, it was overlooked that drv_type could be used
> > > uninitialized. Fix it!
> > >
> > > Fixes: 6186d06c519e21 ("mmc: parse new binding for eMMC fixed driver type")
> > > Reported-by: Colin Ian King <colin.king@canonical.com>
> > > Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> > > Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> > > ---
> > >  drivers/mmc/core/mmc.c | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
> > > index a552f61060d212..0d1c6b025ca596 100644
> > > --- a/drivers/mmc/core/mmc.c
> > > +++ b/drivers/mmc/core/mmc.c
> > > @@ -1290,7 +1290,7 @@ int mmc_hs400_to_hs200(struct mmc_card *card)
> > >
> > >  static void mmc_select_driver_type(struct mmc_card *card)
> > >  {
> > > -       int card_drv_type, drive_strength, drv_type;
> > > +       int card_drv_type, drive_strength, drv_type = 0;
> > >         int fixed_drv_type = card->host->fixed_drv_type;
> > >
> > >         card_drv_type = card->ext_csd.raw_driver_strength |
> > 
> > Could this be the cause of the issues Simon was seeing, cfr. 'Possible
> > regression due to "arm64: renesas: salvator: set driver type for eMMC"'?
> 
> Yes, there is a chance. It still worked for me, though.

I checked, it does not seem to help the issue I reported.
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Ulf Hansson Dec. 5, 2017, 4:24 p.m. UTC | #4
On 30 November 2017 at 15:49, Wolfram Sang
<wsa+renesas@sang-engineering.com> wrote:
> When the latest version of parsing the new eMMC bindings was moved from
> core.c to mmc.c, it was overlooked that drv_type could be used
> uninitialized. Fix it!
>
> Fixes: 6186d06c519e21 ("mmc: parse new binding for eMMC fixed driver type")
> Reported-by: Colin Ian King <colin.king@canonical.com>
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

Thanks, applied for fixes!

Kind regards
Uffe

> ---
>  drivers/mmc/core/mmc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
> index a552f61060d212..0d1c6b025ca596 100644
> --- a/drivers/mmc/core/mmc.c
> +++ b/drivers/mmc/core/mmc.c
> @@ -1290,7 +1290,7 @@ int mmc_hs400_to_hs200(struct mmc_card *card)
>
>  static void mmc_select_driver_type(struct mmc_card *card)
>  {
> -       int card_drv_type, drive_strength, drv_type;
> +       int card_drv_type, drive_strength, drv_type = 0;
>         int fixed_drv_type = card->host->fixed_drv_type;
>
>         card_drv_type = card->ext_csd.raw_driver_strength |
> --
> 2.11.0
>
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
index a552f61060d212..0d1c6b025ca596 100644
--- a/drivers/mmc/core/mmc.c
+++ b/drivers/mmc/core/mmc.c
@@ -1290,7 +1290,7 @@  int mmc_hs400_to_hs200(struct mmc_card *card)
 
 static void mmc_select_driver_type(struct mmc_card *card)
 {
-	int card_drv_type, drive_strength, drv_type;
+	int card_drv_type, drive_strength, drv_type = 0;
 	int fixed_drv_type = card->host->fixed_drv_type;
 
 	card_drv_type = card->ext_csd.raw_driver_strength |