All of lore.kernel.org
 help / color / mirror / Atom feed
* [bug report] net: hns3: Add Ethtool support to HNS3 driver
@ 2017-08-10  9:00 Dan Carpenter
  2017-08-14  9:41 ` Salil Mehta
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2017-08-10  9:00 UTC (permalink / raw)
  To: kernel-janitors

Hello Salil,

The patch 496d03e960ae: "net: hns3: Add Ethtool support to HNS3
driver" from Aug 2, 2017, leads to the following static checker
warning:

	drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_ethtool.c:335 hns3_get_link_ksettings()
	error: uninitialized symbol 'media_type'.

drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_ethtool.c
   300  static int hns3_get_link_ksettings(struct net_device *netdev,
   301                                     struct ethtool_link_ksettings *cmd)
   302  {
   303          struct hns3_nic_priv *priv = netdev_priv(netdev);
   304          struct hnae3_handle *h = priv->ae_handle;
   305          u32 supported_caps;
   306          u32 advertised_caps;
   307          u8 media_type;
                   ^^^^^^^^^^
   308          u8 link_stat;
   309          u8 auto_neg;
   310          u8 duplex;
   311          u32 speed;
   312  
   313          if (!h->ae_algo || !h->ae_algo->ops)
   314                  return -EOPNOTSUPP;
   315  
   316          /* 1.auto_neg&speed&duplex from cmd */
   317          if (h->ae_algo->ops->get_ksettings_an_result) {
   318                  h->ae_algo->ops->get_ksettings_an_result(h, &auto_neg,
   319                                                           &speed, &duplex);
   320                  cmd->base.autoneg = auto_neg;
   321                  cmd->base.speed = speed;
   322                  cmd->base.duplex = duplex;
   323  
   324                  link_stat = hns3_get_link(netdev);
   325                  if (!link_stat) {
   326                          cmd->base.speed = (u32)SPEED_UNKNOWN;
   327                          cmd->base.duplex = DUPLEX_UNKNOWN;
   328                  }
   329          }
   330  
   331          /* 2.media_type get from bios parameter block */
   332          if (h->ae_algo->ops->get_media_type)
   333                  h->ae_algo->ops->get_media_type(h, &media_type);
                                                            ^^^^^^^^^^
Probably make this unconditional?

   334  
   335          switch (media_type) {
   336          case HNAE3_MEDIA_TYPE_FIBER:
   337                  cmd->base.port = PORT_FIBRE;
   338                  supported_caps = HNS3_LM_FIBRE_BIT | HNS3_LM_AUTONEG_BIT |
   339                          HNS3_LM_PAUSE_BIT | HNS3_LM_1000BASET_FULL_BIT;
   340  
   341                  advertised_caps = supported_caps;
   342                  break;


regards,
dan carpenter

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

* RE: [bug report] net: hns3: Add Ethtool support to HNS3 driver
  2017-08-10  9:00 [bug report] net: hns3: Add Ethtool support to HNS3 driver Dan Carpenter
@ 2017-08-14  9:41 ` Salil Mehta
  0 siblings, 0 replies; 2+ messages in thread
From: Salil Mehta @ 2017-08-14  9:41 UTC (permalink / raw)
  To: kernel-janitors

Hi Dan,

> -----Original Message-----
> From: Dan Carpenter [mailto:dan.carpenter@oracle.com]
> Sent: Thursday, August 10, 2017 10:01 AM
> To: Salil Mehta
> Cc: kernel-janitors@vger.kernel.org
> Subject: [bug report] net: hns3: Add Ethtool support to HNS3 driver
> 
> Hello Salil,
> 
> The patch 496d03e960ae: "net: hns3: Add Ethtool support to HNS3
> driver" from Aug 2, 2017, leads to the following static checker
> warning:
Thanks for identifying these. Will fix these!

> 
> 	drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_ethtool.c:335
> hns3_get_link_ksettings()
> 	error: uninitialized symbol 'media_type'.
> 
> drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_ethtool.c
>    300  static int hns3_get_link_ksettings(struct net_device *netdev,
>    301                                     struct
> ethtool_link_ksettings *cmd)
>    302  {
>    303          struct hns3_nic_priv *priv = netdev_priv(netdev);
>    304          struct hnae3_handle *h = priv->ae_handle;
>    305          u32 supported_caps;
>    306          u32 advertised_caps;
>    307          u8 media_type;
>                    ^^^^^^^^^^
>    308          u8 link_stat;
>    309          u8 auto_neg;
>    310          u8 duplex;
>    311          u32 speed;
>    312
>    313          if (!h->ae_algo || !h->ae_algo->ops)
>    314                  return -EOPNOTSUPP;
>    315
>    316          /* 1.auto_neg&speed&duplex from cmd */
>    317          if (h->ae_algo->ops->get_ksettings_an_result) {
>    318                  h->ae_algo->ops->get_ksettings_an_result(h,
> &auto_neg,
>    319
> &speed, &duplex);
>    320                  cmd->base.autoneg = auto_neg;
>    321                  cmd->base.speed = speed;
>    322                  cmd->base.duplex = duplex;
>    323
>    324                  link_stat = hns3_get_link(netdev);
>    325                  if (!link_stat) {
>    326                          cmd->base.speed = (u32)SPEED_UNKNOWN;
>    327                          cmd->base.duplex = DUPLEX_UNKNOWN;
>    328                  }
>    329          }
>    330
>    331          /* 2.media_type get from bios parameter block */
>    332          if (h->ae_algo->ops->get_media_type)
>    333                  h->ae_algo->ops->get_media_type(h,
> &media_type);
>                                                             ^^^^^^^^^^
> Probably make this unconditional?
Right. Will check the absence of the function earlier. Will fix.

Thanks
> 
>    334
>    335          switch (media_type) {
>    336          case HNAE3_MEDIA_TYPE_FIBER:
>    337                  cmd->base.port = PORT_FIBRE;
>    338                  supported_caps = HNS3_LM_FIBRE_BIT |
> HNS3_LM_AUTONEG_BIT |
>    339                          HNS3_LM_PAUSE_BIT |
> HNS3_LM_1000BASET_FULL_BIT;
>    340
>    341                  advertised_caps = supported_caps;
>    342                  break;
> 
> 
> regards,
> dan carpenter

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

end of thread, other threads:[~2017-08-14  9:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-10  9:00 [bug report] net: hns3: Add Ethtool support to HNS3 driver Dan Carpenter
2017-08-14  9:41 ` Salil Mehta

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.