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  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Tue, 27 Oct 2020 18:29:08 -0700
From:   Jakub Kicinski <kuba@...nel.org>
To:     Robert Hancock <robert.hancock@...ian.com>
Cc:     andrew@...n.ch, hkallweit1@...il.com, linux@...linux.org.uk,
        davem@...emloft.net, netdev@...r.kernel.org
Subject: Re: [PATCH net-next v4] net: phy: marvell: add special handling of
 Finisar modules with 88E1111

On Mon, 26 Oct 2020 11:57:14 -0600 Robert Hancock wrote:
> +	/* If using copper mode, ensure 1000BaseX auto-negotiation is enabled */
> +	if ((extsr & MII_M1111_HWCFG_MODE_MASK) ==
> +	    MII_M1111_HWCFG_MODE_COPPER_1000X_NOAN) {
> +		int err = phy_modify(phydev, MII_M1111_PHY_EXT_SR,
> +			  MII_M1111_HWCFG_MODE_MASK |
> +			  MII_M1111_HWCFG_SERIAL_AN_BYPASS,
> +			  MII_M1111_HWCFG_MODE_COPPER_1000X_AN |
> +			  MII_M1111_HWCFG_SERIAL_AN_BYPASS);

Hm. Looks like checkpatch doesn't catch it, but this is at odds with
kernel coding style, isn't it?

1 - continuation lines need to be aligned to '('
2 - new line is required after a variable declaration

IOW:

       if ((extsr & MII_M1111_HWCFG_MODE_MASK) ==
           MII_M1111_HWCFG_MODE_COPPER_1000X_NOAN) {
               int err = phy_modify(phydev, MII_M1111_PHY_EXT_SR,
                                    MII_M1111_HWCFG_MODE_MASK |
                                    MII_M1111_HWCFG_SERIAL_AN_BYPASS,
                                    MII_M1111_HWCFG_MODE_COPPER_1000X_AN |
                                    MII_M1111_HWCFG_SERIAL_AN_BYPASS);

               if (err < 0)
                       return err;
       }

Or:

       if ((extsr & MII_M1111_HWCFG_MODE_MASK) ==
           MII_M1111_HWCFG_MODE_COPPER_1000X_NOAN) {
               int err;

               err = phy_modify(phydev, MII_M1111_PHY_EXT_SR,
                                MII_M1111_HWCFG_MODE_MASK |
                                MII_M1111_HWCFG_SERIAL_AN_BYPASS,
                                MII_M1111_HWCFG_MODE_COPPER_1000X_AN |
                                MII_M1111_HWCFG_SERIAL_AN_BYPASS);
               if (err < 0)
                       return err;
       }

Or better still:

       int err, mode;

       mode = extsr & MII_M1111_HWCFG_MODE_MASK;
       if (mode == MII_M1111_HWCFG_MODE_COPPER_1000X_NOAN) {
               err = phy_modify(phydev, MII_M1111_PHY_EXT_SR,
                                MII_M1111_HWCFG_MODE_MASK |
                                MII_M1111_HWCFG_SERIAL_AN_BYPASS,
                                MII_M1111_HWCFG_MODE_COPPER_1000X_AN |
                                MII_M1111_HWCFG_SERIAL_AN_BYPASS);
               if (err < 0)
                       return err;
       }


> +		if (err < 0)
> +			return err;
> +	}

Powered by blists - more mailing lists