Skip to contentSkip to conversation

hns compiler warnings

DISCUSSION Jason Gunthorpe 2 participants 2 messages Dec 29, 2017 – Jan 6, 2018 1 message not in the archive InfiniBand

lore
Share & tools
lore
#0 lore raw

When !CONFIG_REGMAP hns throws compiler warnings since dsaf_read_syscon ignores the return result from regmap_read, which allows val to be uninited. This looks like a bug to me.

Could someone please send a patch to fix this? It probably isn't a good idea to wrapper regmap_read with something that throws away the return code.

Thanks
Jason

drivers/net/ethernet/hisilicon/hns/hns_dsaf_misc.c: In function ‘cpld_set_led_id’:
drivers/net/ethernet/hisilicon/hns/hns_dsaf_misc.c:165:26: warning: ‘val’ may be used uninitialized in this function [-Wmaybe-uninitialized]
mac_cb->cpld_led_value =
~~~~~~~~~~~~~~~~~~~~~~~^

    dsaf_read_syscon(mac_cb->cpld_ctrl,
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       mac_cb->cpld_ctrl_reg);
       ~~~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/hisilicon/hns/hns_dsaf_misc.c: In function ‘hns_mac_get_sfp_prsnt’:
drivers/net/ethernet/hisilicon/hns/hns_dsaf_misc.c:511:15: warning: ‘val’ may be used uninitialized in this function [-Wmaybe-uninitialized]
  *sfp_prsnt = !dsaf_read_syscon(mac_cb->cpld_ctrl, mac_cb->cpld_ctrl_reg
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      + MAC_SFP_PORT_OFFSET);
      ~~~~~~~~~~~~~~~~~~~~~~

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 20171229195832.GG6513-uk2M96/[email protected]

#2 lore raw

Hi Jason,

Thanks for this. We will fix it as soon as possible.

Yisen

Quoted 15 lines · Jason Gunthorpe

When !CONFIG_REGMAP hns throws compiler warnings since dsaf_read_syscon ignores the return result from regmap_read, which allows val to be uninited. This looks like a bug to me.

Could someone please send a patch to fix this? It probably isn't a good idea to wrapper regmap_read with something that throws away the return code.

Thanks
Jason

drivers/net/ethernet/hisilicon/hns/hns_dsaf_misc.c: In function ‘cpld_set_led_id’:
drivers/net/ethernet/hisilicon/hns/hns_dsaf_misc.c:165:26: warning: ‘val’ may be used uninitialized in this function [-Wmaybe-uninitialized]
mac_cb->cpld_led_value =
~~~~~~~~~~~~~~~~~~~~~~~^

Quoted 12 lines
    dsaf_read_syscon(mac_cb->cpld_ctrl,
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       mac_cb->cpld_ctrl_reg);
       ~~~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/hisilicon/hns/hns_dsaf_misc.c: In function ‘hns_mac_get_sfp_prsnt’:
drivers/net/ethernet/hisilicon/hns/hns_dsaf_misc.c:511:15: warning: ‘val’ may be used uninitialized in this function [-Wmaybe-uninitialized]
  *sfp_prsnt = !dsaf_read_syscon(mac_cb->cpld_ctrl, mac_cb->cpld_ctrl_reg
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      + MAC_SFP_PORT_OFFSET);
      ~~~~~~~~~~~~~~~~~~~~~~

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html