public inbox for linux-mmc@vger.kernel.org
 help / color / mirror / Atom feed
* re: mmc: mediatek: add HS400 support
@ 2016-03-10 21:19 Dan Carpenter
  0 siblings, 0 replies; 2+ messages in thread
From: Dan Carpenter @ 2016-03-10 21:19 UTC (permalink / raw)
  To: chaotian.jing; +Cc: linux-mmc

Hello Chaotian Jing,

The patch 6397b7f5f405: "mmc: mediatek: add HS400 support" from Oct
27, 2015, leads to the following static checker warning:

	drivers/mmc/host/mtk-sd.c:1320 msdc_tune_response()
	error: XXX potentially using uninitialized 'cmd_err'.

drivers/mmc/host/mtk-sd.c
  1306  static int msdc_tune_response(struct mmc_host *mmc, u32 opcode)
  1307  {
  1308          struct msdc_host *host = mmc_priv(mmc);
  1309          u32 rise_delay = 0, fall_delay = 0;
  1310          struct msdc_delay_phase final_rise_delay, final_fall_delay;
  1311          u8 final_delay, final_maxlen;
  1312          int cmd_err;
                    ^^^^^^^

  1313          int i;
  1314  
  1315          sdr_clr_bits(host->base + MSDC_IOCON, MSDC_IOCON_RSPL);
  1316          for (i = 0 ; i < PAD_DELAY_MAX; i++) {
  1317                  sdr_set_field(host->base + MSDC_PAD_TUNE,
  1318                                MSDC_PAD_TUNE_CMDRDLY, i);
  1319                  mmc_send_tuning(mmc, opcode, &cmd_err);
                                                     ^^^^^^^^
If kmalloc fails then it's not initialized.

  1320                  if (!cmd_err)
                             ^^^^^^^
  1321                          rise_delay |= (1 << i);
  1322          }

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 2+ messages in thread
* re: mmc: mediatek: add HS400 support
@ 2016-04-02  8:46 Dan Carpenter
  0 siblings, 0 replies; 2+ messages in thread
From: Dan Carpenter @ 2016-04-02  8:46 UTC (permalink / raw)
  Cc: Chaotian Jing, linux-mmc

Hello Chaotian Jing,

The patch 6397b7f5f405: "mmc: mediatek: add HS400 support" from Oct
27, 2015, leads to the following static checker warning:

	drivers/mmc/host/mtk-sd.c:1320 msdc_tune_response()
	error: uninitialized variable 'cmd_err'.

drivers/mmc/host/mtk-sd.c
  1306  static int msdc_tune_response(struct mmc_host *mmc, u32 opcode)
  1307  {
  1308          struct msdc_host *host = mmc_priv(mmc);
  1309          u32 rise_delay = 0, fall_delay = 0;
  1310          struct msdc_delay_phase final_rise_delay, final_fall_delay;
  1311          u8 final_delay, final_maxlen;
  1312          int cmd_err;
                    ^^^^^^^
  1313          int i;
  1314  
  1315          sdr_clr_bits(host->base + MSDC_IOCON, MSDC_IOCON_RSPL);
  1316          for (i = 0 ; i < PAD_DELAY_MAX; i++) {
  1317                  sdr_set_field(host->base + MSDC_PAD_TUNE,
  1318                                MSDC_PAD_TUNE_CMDRDLY, i);
  1319                  mmc_send_tuning(mmc, opcode, &cmd_err);
                                                      ^^^^^^^
No error handling.

  1320                  if (!cmd_err)
                             ^^^^^^^
  1321                          rise_delay |= (1 << i);
  1322          }


regards,
dan carpenter

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

end of thread, other threads:[~2016-04-02  8:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-10 21:19 mmc: mediatek: add HS400 support Dan Carpenter
  -- strict thread matches above, loose matches on Subject: below --
2016-04-02  8:46 Dan Carpenter

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