Skip to contentSkip to conversation

staging: mt7621-mmc: MIPS: ralink: add sdhci for mt7620a SoC

bug report Dan Carpenter 3 participants 3 messages Apr 5, 2018 Arm MediaTek

lore
Share & tools
lore
#0 lore raw

Hello John Crispin,

The patch 8b634a9c7620: "staging: mt7621-mmc: MIPS: ralink: add sdhci for mt7620a SoC" from Mar 15, 2018, leads to the following static checker warning:

	drivers/staging/mt7621-mmc/sd.c:2790 msdc_drv_probe()
	warn: curly braces intended?

drivers/staging/mt7621-mmc/sd.c
2777 /* For sd card: MSDC_SYS_SUSPEND | MSDC_WP_PIN_EN | MSDC_CD_PIN_EN | MSDC_REMOVABLE | MSDC_HIGHSPEED,
2778 For sdio : MSDC_EXT_SDIO_IRQ | MSDC_HIGHSPEED */
2779 if (hw->flags & MSDC_HIGHSPEED) {
2780 mmc->caps = MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED;
2781 }
2782 if (hw->data_pins == 4) { /* current data_pins are all 4*/
2783 mmc->caps |= MMC_CAP_4_BIT_DATA;
2784 } else if (hw->data_pins == 8) {
2785 mmc->caps |= MMC_CAP_8_BIT_DATA;
2786 }
2787 if ((hw->flags & MSDC_SDIO_IRQ) || (hw->flags & MSDC_EXT_SDIO_IRQ))

Are curly braces intended for this if statement?

  2788          mmc->caps |= MMC_CAP_SDIO_IRQ;  /* yes for sdio */
  2789  
  2790          cd_active_low = !of_property_read_bool(pdev->dev.of_node, "mediatek,cd-high");
  2791          mtk_sw_poll = of_property_read_bool(pdev->dev.of_node, "mediatek,cd-poll");
  2792  
  2793          if (mtk_sw_poll)
  2794                  mmc->caps |= MMC_CAP_NEEDS_POLL;

because the indenting seems to say that the braces should reach up to here.

  2795  
  2796      /* MMC core transfer sizes tunable parameters */
  2797  #if LINUX_VERSION_CODE > KERNEL_VERSION(3,10,0)
  2798      mmc->max_segs      = MAX_HW_SGMTS;
  2799  #else
  2800      mmc->max_hw_segs   = MAX_HW_SGMTS;
  2801      mmc->max_phys_segs = MAX_PHY_SGMTS;
  2802  #endif

regards,
dan carpenter

#1 lore raw

Hi Dan,

I explained why I think this should not be merged, i do not plan to fix any issues, please send all maintenance requests towards NeilBrown.

And .. it was merged it with an out dated defunct mail addr of mine.

    John

Quoted 45 lines · Dan Carpenter

Hello John Crispin,

The patch 8b634a9c7620: "staging: mt7621-mmc: MIPS: ralink: add sdhci for mt7620a SoC" from Mar 15, 2018, leads to the following static checker warning:

	drivers/staging/mt7621-mmc/sd.c:2790 msdc_drv_probe()
	warn: curly braces intended?

drivers/staging/mt7621-mmc/sd.c
2777 /* For sd card: MSDC_SYS_SUSPEND | MSDC_WP_PIN_EN | MSDC_CD_PIN_EN | MSDC_REMOVABLE | MSDC_HIGHSPEED,
2778 For sdio : MSDC_EXT_SDIO_IRQ | MSDC_HIGHSPEED */

   2779      if (hw->flags & MSDC_HIGHSPEED) {
   2780          mmc->caps   = MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED;
   2781      }
   2782      if (hw->data_pins == 4) { /* current data_pins are all 4*/
   2783          mmc->caps  |= MMC_CAP_4_BIT_DATA;
   2784      } else if (hw->data_pins == 8) {
   2785          mmc->caps  |= MMC_CAP_8_BIT_DATA;
   2786      }
   2787      if ((hw->flags & MSDC_SDIO_IRQ) || (hw->flags & MSDC_EXT_SDIO_IRQ))

Are curly braces intended for this if statement?

   2788          mmc->caps |= MMC_CAP_SDIO_IRQ;  /* yes for sdio */
   2789
   2790          cd_active_low = !of_property_read_bool(pdev->dev.of_node, "mediatek,cd-high");
   2791          mtk_sw_poll = of_property_read_bool(pdev->dev.of_node, "mediatek,cd-poll");
   2792
   2793          if (mtk_sw_poll)
   2794                  mmc->caps |= MMC_CAP_NEEDS_POLL;

because the indenting seems to say that the braces should reach up to here.

   2795
   2796      /* MMC core transfer sizes tunable parameters */
   2797  #if LINUX_VERSION_CODE > KERNEL_VERSION(3,10,0)
   2798      mmc->max_segs      = MAX_HW_SGMTS;
   2799  #else
   2800      mmc->max_hw_segs   = MAX_HW_SGMTS;
   2801      mmc->max_phys_segs = MAX_PHY_SGMTS;
   2802  #endif
Quoted 7 lines

regards,
dan carpenter

_______________________________________________
Linux-mediatek mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek

_______________________________________________
devel mailing list
[email protected]
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

#2 lore raw
In reply to Dan Carpenter
Quoted 8 lines · Dan Carpenter

Hello John Crispin,

The patch 8b634a9c7620: "staging: mt7621-mmc: MIPS: ralink: add sdhci for mt7620a SoC" from Mar 15, 2018, leads to the following static checker warning:

	drivers/staging/mt7621-mmc/sd.c:2790 msdc_drv_probe()
	warn: curly braces intended?

Hi Dan,

in my understanding of the code around that place, these lines are only indented by accident. The card detect low/high selection and the activation of software poll should happen even when the SDIO(_EXT) interrupt is not enabled, because they are not related.

The indentation will be fixed, once the patch series I sent yesterday in version 2 gets merged.

Hopefully this answer is helpful,
Christian