Linux MultiMedia Card development
 help / color / mirror / Atom feed
* [bug report] mmc: starfive: Add sdio/emmc driver support
@ 2023-02-27  7:06 Dan Carpenter
  2023-02-27  7:26 ` William Qiu
  0 siblings, 1 reply; 4+ messages in thread
From: Dan Carpenter @ 2023-02-27  7:06 UTC (permalink / raw)
  To: william.qiu; +Cc: linux-mmc

Hello William Qiu,

The patch 9e622229bbf4: "mmc: starfive: Add sdio/emmc driver support"
from Feb 15, 2023, leads to the following Smatch static checker
warning:

	drivers/mmc/host/dw_mmc-starfive.c:77 dw_mci_starfive_execute_tuning()
	error: uninitialized symbol 'prev_err'.

drivers/mmc/host/dw_mmc-starfive.c
    47 static int dw_mci_starfive_execute_tuning(struct dw_mci_slot *slot,
    48                                              u32 opcode)
    49 {
    50         static const int grade  = MAX_DELAY_CHAIN;
    51         struct dw_mci *host = slot->host;
    52         struct starfive_priv *priv = host->priv;
    53         int rise_point = -1, fall_point = -1;
    54         int err, prev_err;
    55         int i;
    56         bool found = 0;
    57         u32 regval;
    58 
    59         /*
    60          * Use grade as the max delay chain, and use the rise_point and
    61          * fall_point to ensure the best sampling point of a data input
    62          * signals.
    63          */
    64         for (i = 0; i < grade; i++) {
    65                 regval = i << priv->syscon_shift;
    66                 err = regmap_update_bits(priv->reg_syscon, priv->syscon_offset,
    67                                                 priv->syscon_mask, regval);
    68                 if (err)
    69                         return err;
    70                 mci_writel(host, RINTSTS, ALL_INT_CLR);
    71 
    72                 err = mmc_send_tuning(slot->mmc, opcode, NULL);
    73                 if (!err)
    74                         found = 1;
    75 
    76                 if (i > 0) {
--> 77                         if (err && !prev_err)

prev_err was never initialized to zero.

    78                                 fall_point = i - 1;
    79                         if (!err && prev_err)
    80                                 rise_point = i;
    81                 }
    82 
    83                 if (rise_point != -1 && fall_point != -1)
    84                         goto tuning_out;
    85 
    86                 prev_err = err;
    87                 err = 0;
    88         }
    89 

regards,
dan carpenter

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

* Re: [bug report] mmc: starfive: Add sdio/emmc driver support
  2023-02-27  7:06 [bug report] mmc: starfive: Add sdio/emmc driver support Dan Carpenter
@ 2023-02-27  7:26 ` William Qiu
  2023-02-27  7:29   ` Dan Carpenter
  0 siblings, 1 reply; 4+ messages in thread
From: William Qiu @ 2023-02-27  7:26 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: linux-mmc



On 2023/2/27 15:06, Dan Carpenter wrote:
> Hello William Qiu,
> 
> The patch 9e622229bbf4: "mmc: starfive: Add sdio/emmc driver support"
> from Feb 15, 2023, leads to the following Smatch static checker
> warning:
> 
> 	drivers/mmc/host/dw_mmc-starfive.c:77 dw_mci_starfive_execute_tuning()
> 	error: uninitialized symbol 'prev_err'.
> 
> drivers/mmc/host/dw_mmc-starfive.c
>     47 static int dw_mci_starfive_execute_tuning(struct dw_mci_slot *slot,
>     48                                              u32 opcode)
>     49 {
>     50         static const int grade  = MAX_DELAY_CHAIN;
>     51         struct dw_mci *host = slot->host;
>     52         struct starfive_priv *priv = host->priv;
>     53         int rise_point = -1, fall_point = -1;
>     54         int err, prev_err;
>     55         int i;
>     56         bool found = 0;
>     57         u32 regval;
>     58 
>     59         /*
>     60          * Use grade as the max delay chain, and use the rise_point and
>     61          * fall_point to ensure the best sampling point of a data input
>     62          * signals.
>     63          */
>     64         for (i = 0; i < grade; i++) {
>     65                 regval = i << priv->syscon_shift;
>     66                 err = regmap_update_bits(priv->reg_syscon, priv->syscon_offset,
>     67                                                 priv->syscon_mask, regval);
>     68                 if (err)
>     69                         return err;
>     70                 mci_writel(host, RINTSTS, ALL_INT_CLR);
>     71 
>     72                 err = mmc_send_tuning(slot->mmc, opcode, NULL);
>     73                 if (!err)
>     74                         found = 1;
>     75 
>     76                 if (i > 0) {
> --> 77                         if (err && !prev_err)
> 
> prev_err was never initialized to zero.
> 
Hi Carpenter,

I will fixed it. But what should I do next,send a new version to fixed 
it or send a patch to you?

Best regards
William
>     78                                 fall_point = i - 1;
>     79                         if (!err && prev_err)
>     80                                 rise_point = i;
>     81                 }
>     82 
>     83                 if (rise_point != -1 && fall_point != -1)
>     84                         goto tuning_out;
>     85 
>     86                 prev_err = err;
>     87                 err = 0;
>     88         }
>     89 
> 
> regards,
> dan carpenter

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

* Re: [bug report] mmc: starfive: Add sdio/emmc driver support
  2023-02-27  7:26 ` William Qiu
@ 2023-02-27  7:29   ` Dan Carpenter
  2023-02-27  7:37     ` William Qiu
  0 siblings, 1 reply; 4+ messages in thread
From: Dan Carpenter @ 2023-02-27  7:29 UTC (permalink / raw)
  To: William Qiu; +Cc: linux-mmc

On Mon, Feb 27, 2023 at 03:26:58PM +0800, William Qiu wrote:
> 
> 
> On 2023/2/27 15:06, Dan Carpenter wrote:
> > Hello William Qiu,
> > 
> > The patch 9e622229bbf4: "mmc: starfive: Add sdio/emmc driver support"
> > from Feb 15, 2023, leads to the following Smatch static checker
> > warning:
> > 
> > 	drivers/mmc/host/dw_mmc-starfive.c:77 dw_mci_starfive_execute_tuning()
> > 	error: uninitialized symbol 'prev_err'.
> > 
> > drivers/mmc/host/dw_mmc-starfive.c
> >     47 static int dw_mci_starfive_execute_tuning(struct dw_mci_slot *slot,
> >     48                                              u32 opcode)
> >     49 {
> >     50         static const int grade  = MAX_DELAY_CHAIN;
> >     51         struct dw_mci *host = slot->host;
> >     52         struct starfive_priv *priv = host->priv;
> >     53         int rise_point = -1, fall_point = -1;
> >     54         int err, prev_err;
> >     55         int i;
> >     56         bool found = 0;
> >     57         u32 regval;
> >     58 
> >     59         /*
> >     60          * Use grade as the max delay chain, and use the rise_point and
> >     61          * fall_point to ensure the best sampling point of a data input
> >     62          * signals.
> >     63          */
> >     64         for (i = 0; i < grade; i++) {
> >     65                 regval = i << priv->syscon_shift;
> >     66                 err = regmap_update_bits(priv->reg_syscon, priv->syscon_offset,
> >     67                                                 priv->syscon_mask, regval);
> >     68                 if (err)
> >     69                         return err;
> >     70                 mci_writel(host, RINTSTS, ALL_INT_CLR);
> >     71 
> >     72                 err = mmc_send_tuning(slot->mmc, opcode, NULL);
> >     73                 if (!err)
> >     74                         found = 1;
> >     75 
> >     76                 if (i > 0) {
> > --> 77                         if (err && !prev_err)
> > 
> > prev_err was never initialized to zero.
> > 
> Hi Carpenter,
> 
> I will fixed it. But what should I do next,send a new version to fixed 
> it or send a patch to you?

Heh?!  No, leave me out of it.  Just send a patch with a Fixes tag to
the linux-mmc@vger.kernel.org and the maintainers and so on.  Please
give me a Reported-by: Dan Carpenter <error27@gmail.com> credit though.

regards,
dan carpenter


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

* Re: [bug report] mmc: starfive: Add sdio/emmc driver support
  2023-02-27  7:29   ` Dan Carpenter
@ 2023-02-27  7:37     ` William Qiu
  0 siblings, 0 replies; 4+ messages in thread
From: William Qiu @ 2023-02-27  7:37 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: linux-mmc



On 2023/2/27 15:29, Dan Carpenter wrote:
> On Mon, Feb 27, 2023 at 03:26:58PM +0800, William Qiu wrote:
>> 
>> 
>> On 2023/2/27 15:06, Dan Carpenter wrote:
>> > Hello William Qiu,
>> > 
>> > The patch 9e622229bbf4: "mmc: starfive: Add sdio/emmc driver support"
>> > from Feb 15, 2023, leads to the following Smatch static checker
>> > warning:
>> > 
>> > 	drivers/mmc/host/dw_mmc-starfive.c:77 dw_mci_starfive_execute_tuning()
>> > 	error: uninitialized symbol 'prev_err'.
>> > 
>> > drivers/mmc/host/dw_mmc-starfive.c
>> >     47 static int dw_mci_starfive_execute_tuning(struct dw_mci_slot *slot,
>> >     48                                              u32 opcode)
>> >     49 {
>> >     50         static const int grade  = MAX_DELAY_CHAIN;
>> >     51         struct dw_mci *host = slot->host;
>> >     52         struct starfive_priv *priv = host->priv;
>> >     53         int rise_point = -1, fall_point = -1;
>> >     54         int err, prev_err;
>> >     55         int i;
>> >     56         bool found = 0;
>> >     57         u32 regval;
>> >     58 
>> >     59         /*
>> >     60          * Use grade as the max delay chain, and use the rise_point and
>> >     61          * fall_point to ensure the best sampling point of a data input
>> >     62          * signals.
>> >     63          */
>> >     64         for (i = 0; i < grade; i++) {
>> >     65                 regval = i << priv->syscon_shift;
>> >     66                 err = regmap_update_bits(priv->reg_syscon, priv->syscon_offset,
>> >     67                                                 priv->syscon_mask, regval);
>> >     68                 if (err)
>> >     69                         return err;
>> >     70                 mci_writel(host, RINTSTS, ALL_INT_CLR);
>> >     71 
>> >     72                 err = mmc_send_tuning(slot->mmc, opcode, NULL);
>> >     73                 if (!err)
>> >     74                         found = 1;
>> >     75 
>> >     76                 if (i > 0) {
>> > --> 77                         if (err && !prev_err)
>> > 
>> > prev_err was never initialized to zero.
>> > 
>> Hi Carpenter,
>> 
>> I will fixed it. But what should I do next,send a new version to fixed 
>> it or send a patch to you?
> 
> Heh?!  No, leave me out of it.  Just send a patch with a Fixes tag to
> the linux-mmc@vger.kernel.org and the maintainers and so on.  Please
> give me a Reported-by: Dan Carpenter <error27@gmail.com> credit though.
> 
> regards,
> dan carpenter
> 

Fine, I'll do it then. Thanks anyway.

Best regards
William

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

end of thread, other threads:[~2023-02-27  7:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-27  7:06 [bug report] mmc: starfive: Add sdio/emmc driver support Dan Carpenter
2023-02-27  7:26 ` William Qiu
2023-02-27  7:29   ` Dan Carpenter
2023-02-27  7:37     ` William Qiu

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