lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <F4CC6FACFEB3C54C9141D49AD221F7F93B82AA4A@FRAEML521-MBX.china.huawei.com>
Date:   Fri, 28 Jul 2017 23:50:38 +0000
From:   Salil Mehta <salil.mehta@...wei.com>
To:     Andrew Lunn <andrew@...n.ch>
CC:     "davem@...emloft.net" <davem@...emloft.net>,
        "Zhuangyuzeng (Yisen)" <yisen.zhuang@...wei.com>,
        huangdaode <huangdaode@...ilicon.com>,
        "lipeng (Y)" <lipeng321@...wei.com>,
        "mehta.salil.lnk@...il.com" <mehta.salil.lnk@...il.com>,
        "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "linux-rdma@...r.kernel.org" <linux-rdma@...r.kernel.org>,
        Linuxarm <linuxarm@...wei.com>
Subject: RE: [PATCH V5 net-next 6/8] net: hns3: Add MDIO support to HNS3
 Ethernet driver for hip08 SoC

Hi Andrew,

> -----Original Message-----
> From: Andrew Lunn [mailto:andrew@...n.ch]
> Sent: Saturday, July 29, 2017 12:24 AM
> To: Salil Mehta
> Cc: davem@...emloft.net; Zhuangyuzeng (Yisen); huangdaode; lipeng (Y);
> mehta.salil.lnk@...il.com; netdev@...r.kernel.org; linux-
> kernel@...r.kernel.org; linux-rdma@...r.kernel.org; Linuxarm
> Subject: Re: [PATCH V5 net-next 6/8] net: hns3: Add MDIO support to
> HNS3 Ethernet driver for hip08 SoC
> 
> > +static void hclge_mac_adjust_link(struct net_device *netdev)
> > +{
> > +	struct hnae3_handle *h = *((void **)netdev_priv(netdev));
> > +	struct hclge_vport *vport = hclge_get_vport(h);
> > +	struct hclge_dev *hdev = vport->back;
> > +	int duplex, speed;
> > +	int ret;
> > +
> > +	speed = netdev->phydev->speed;
> > +	duplex = netdev->phydev->duplex;
> > +
> > +	ret = hclge_cfg_mac_speed_dup(hdev, speed, duplex);
> > +	if (ret)
> > +		dev_err(&hdev->pdev->dev, "adjust link fail.\n");
> 
> Here and hclge_mac_start_phy() you have a netdev, so you should be
> using netdev_err()
Ok sure. Will replace in next patch.

> 
> > +}
> > +
> > +int hclge_mac_start_phy(struct hclge_dev *hdev)
> > +{
> > +	struct net_device *netdev = hdev->vport[0].nic.netdev;
> > +	struct phy_device *phydev = hdev->hw.mac.phydev;
> > +	int ret;
> > +
> > +	if (!phydev)
> > +		return 0;
> > +
> > +	ret = phy_connect_direct(netdev, phydev,
> > +				 hclge_mac_adjust_link,
> > +				 PHY_INTERFACE_MODE_SGMII);
> > +	if (ret) {
> > +		pr_info("phy_connect_direct err");
> > +		return ret;
> 
> netdev_err(). checkpatch probably gave you a warning about this?
No, it did not.

> 
> > +	}
> > +
> > +	phy_start(phydev);
> > +
> > +	return 0;
> > +}
> > +
> > +void hclge_mac_stop_phy(struct hclge_dev *hdev)
> > +{
> > +	struct net_device *netdev = hdev->vport[0].nic.netdev;
> > +	struct phy_device *phydev = netdev->phydev;
> > +
> > +	phy_stop(phydev);
> > +	phy_disconnect(phydev);
> > +}
> 
> In hclge_mac_start_phy() you check for !phydev. Here you
> unconditionally use phydev. Seems inconsistent.
Yes, I think NULL check for phy should be present here as well.

> 
> 	Andrew

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ