public inbox for linux-mmc@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: wsa+renesas@sang-engineering.com
Cc: linux-mmc@vger.kernel.org
Subject: [bug report] mmc: renesas_sdhi: abort tuning when timeout detected
Date: Tue, 30 Nov 2021 13:41:21 +0300	[thread overview]
Message-ID: <20211130104121.GC5827@kili> (raw)

Hello Wolfram Sang,

The patch 2c9017d0b5d3: "mmc: renesas_sdhi: abort tuning when timeout
detected" from Jun 2, 2021, leads to the following Smatch static
checker warning:

	drivers/mmc/host/renesas_sdhi_core.c:701 renesas_sdhi_execute_tuning()
	error: uninitialized symbol 'cmd_error'.

drivers/mmc/host/renesas_sdhi_core.c
    669 static int renesas_sdhi_execute_tuning(struct mmc_host *mmc, u32 opcode)
    670 {
    671         struct tmio_mmc_host *host = mmc_priv(mmc);
    672         struct renesas_sdhi *priv = host_to_priv(host);
    673         int i, ret;
    674 
    675         priv->tap_num = renesas_sdhi_init_tuning(host);
    676         if (!priv->tap_num)
    677                 return 0; /* Tuning is not supported */
    678 
    679         if (priv->tap_num * 2 >= sizeof(priv->taps) * BITS_PER_BYTE) {
    680                 dev_err(&host->pdev->dev,
    681                         "Too many taps, please update 'taps' in tmio_mmc_host!\n");
    682                 return -EINVAL;
    683         }
    684 
    685         bitmap_zero(priv->taps, priv->tap_num * 2);
    686         bitmap_zero(priv->smpcmp, priv->tap_num * 2);
    687 
    688         /* Issue CMD19 twice for each tap */
    689         for (i = 0; i < 2 * priv->tap_num; i++) {
    690                 int cmd_error;
                        ^^^^^^^^^^^^^

    691 
    692                 /* Set sampling clock position */
    693                 sd_scc_write32(host, priv, SH_MOBILE_SDHI_SCC_TAPSET, i % priv->tap_num);
    694 
    695                 if (mmc_send_tuning(mmc, opcode, &cmd_error) == 0)
                                                         ^^^^^^^^^^
This is not necessarily initialized on some error paths in mmc_send_tuning()

    696                         set_bit(i, priv->taps);
    697 
    698                 if (sd_scc_read32(host, priv, SH_MOBILE_SDHI_SCC_SMPCMP) == 0)
    699                         set_bit(i, priv->smpcmp);
    700 
--> 701                 if (cmd_error)
                            ^^^^^^^^^
warning.

    702                         mmc_send_abort_tuning(mmc, opcode);
    703         }
    704 
    705         ret = renesas_sdhi_select_tuning(host);
    706         if (ret < 0)
    707                 renesas_sdhi_scc_reset(host, priv);
    708         return ret;
    709 }

regards,
dan carpenter

             reply	other threads:[~2021-11-30 10:42 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-30 10:41 Dan Carpenter [this message]
2021-11-30 13:10 ` [bug report] mmc: renesas_sdhi: abort tuning when timeout detected Wolfram Sang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211130104121.GC5827@kili \
    --to=dan.carpenter@oracle.com \
    --cc=linux-mmc@vger.kernel.org \
    --cc=wsa+renesas@sang-engineering.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox