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: <20201105174017.48ddfa3e@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com>
Date:   Thu, 5 Nov 2020 17:40:17 -0800
From:   Jakub Kicinski <kuba@...nel.org>
To:     Pavana Sharma <pavana.sharma@...i.com>
Cc:     andrew@...n.ch, ashkan.boldaji@...i.com, davem@...emloft.net,
        f.fainelli@...il.com, gregkh@...uxfoundation.org,
        linux-kernel@...r.kernel.org, marek.behun@....cz,
        netdev@...r.kernel.org, vivien.didelot@...il.com
Subject: Re: [PATCH v8 3/4] net: dsa: mv88e6xxx: Change serdes lane
 parameter  from u8 type to int

On Tue,  3 Nov 2020 18:50:02 +1000 Pavana Sharma wrote:
> Returning 0 is no more an error case with MV88E6393 family
> which has serdes lane numbers 0, 9 or 10.
> So with this change .serdes_get_lane will return lane number
> or error (-ENODEV).
> 
> Signed-off-by: Pavana Sharma <pavana.sharma@...i.com>

>  	mv88e6xxx_reg_lock(chip);
>  	lane = mv88e6xxx_serdes_get_lane(chip, port);
> -	if (lane && chip->info->ops->serdes_pcs_get_state)
> +	if ((lane >= 0) && chip->info->ops->serdes_pcs_get_state)

unnecessary parenthesis, checkpatch even warns about this

>  		err = chip->info->ops->serdes_pcs_get_state(chip, port, lane,
>  							    state);
>  	else


> @@ -522,15 +522,15 @@ static void mv88e6xxx_serdes_pcs_an_restart(struct dsa_switch *ds, int port)
>  {
>  	struct mv88e6xxx_chip *chip = ds->priv;
>  	const struct mv88e6xxx_ops *ops;
> +	int lane;
>  	int err = 0;

Please keep the reverse xmas tree order of variables

int lane; should be after int err = 0; 

We're ordering full lines, not just the type and name.

> -	u8 lane;
>  
>  	ops = chip->info->ops;
>  
>  	if (ops->serdes_pcs_an_restart) {
>  		mv88e6xxx_reg_lock(chip);
>  		lane = mv88e6xxx_serdes_get_lane(chip, port);
> -		if (lane)
> +		if (lane >= 0)
>  			err = ops->serdes_pcs_an_restart(chip, port, lane);
>  		mv88e6xxx_reg_unlock(chip);

>  void mv88e6390_serdes_get_regs(struct mv88e6xxx_chip *chip, int port, void *_p)
>  {
> -	u16 *p = _p;
>  	int lane;
> +	u16 *p = _p;
>  	u16 reg;
>  	int i;

ditto

> @@ -129,18 +129,18 @@ void mv88e6352_serdes_get_regs(struct mv88e6xxx_chip *chip, int port, void *_p);
>  int mv88e6390_serdes_get_regs_len(struct mv88e6xxx_chip *chip, int port);
>  void mv88e6390_serdes_get_regs(struct mv88e6xxx_chip *chip, int port, void *_p);
>  
> -/* Return the (first) SERDES lane address a port is using, 0 otherwise. */
> +/* Return the (first) SERDES lane address a port is using, ERROR otherwise. */

The usual notation is -errno, instead of ERROR.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ