* [bug report] mmc: renesas_sdhi: abort tuning when timeout detected
@ 2021-11-30 10:41 Dan Carpenter
2021-11-30 13:10 ` Wolfram Sang
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2021-11-30 10:41 UTC (permalink / raw)
To: wsa+renesas; +Cc: linux-mmc
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [bug report] mmc: renesas_sdhi: abort tuning when timeout detected
2021-11-30 10:41 [bug report] mmc: renesas_sdhi: abort tuning when timeout detected Dan Carpenter
@ 2021-11-30 13:10 ` Wolfram Sang
0 siblings, 0 replies; 2+ messages in thread
From: Wolfram Sang @ 2021-11-30 13:10 UTC (permalink / raw)
To: Dan Carpenter; +Cc: linux-mmc
[-- Attachment #1: Type: text/plain, Size: 281 bytes --]
> 695 if (mmc_send_tuning(mmc, opcode, &cmd_error) == 0)
> ^^^^^^^^^^
> This is not necessarily initialized on some error paths in mmc_send_tuning()
True. Thanks Dan for the report, I will send a fix.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-11-30 13:10 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-11-30 10:41 [bug report] mmc: renesas_sdhi: abort tuning when timeout detected Dan Carpenter
2021-11-30 13:10 ` Wolfram Sang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox