All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ameer Hamza <amhamza.mgc@gmail.com>
To: kabel@kernel.org, kuba@kernel.org, andrew@lunn.ch
Cc: vivien.didelot@gmail.com, f.fainelli@gmail.com,
	olteanv@gmail.com, davem@davemloft.net, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] net: dsa: mv88e6xxx: error handling for serdes_power functions
Date: Wed, 8 Dec 2021 19:09:57 +0500	[thread overview]
Message-ID: <20211208140957.GA96979@hamza-OptiPlex-7040> (raw)
In-Reply-To: <20211208140413.96856-1-amhamza.mgc@gmail.com>

On Wed, Dec 08, 2021 at 07:04:13PM +0500, Ameer Hamza wrote:
> mv88e6390_serdes_power() and mv88e6393x_serdes_power() should return
> with EINVAL error if cmode is undefined.
> 
> Signed-off-by: Ameer Hamza <amhamza.mgc@gmail.com>
> ---
>  drivers/net/dsa/mv88e6xxx/serdes.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/dsa/mv88e6xxx/serdes.c b/drivers/net/dsa/mv88e6xxx/serdes.c
> index 33727439724a..f3dc1865f291 100644
> --- a/drivers/net/dsa/mv88e6xxx/serdes.c
> +++ b/drivers/net/dsa/mv88e6xxx/serdes.c
> @@ -830,7 +830,7 @@ int mv88e6390_serdes_power(struct mv88e6xxx_chip *chip, int port, int lane,
>  			   bool up)
>  {
>  	u8 cmode = chip->ports[port].cmode;
> -	int err = 0;
> +	int err;
>  
>  	switch (cmode) {
>  	case MV88E6XXX_PORT_STS_CMODE_SGMII:
> @@ -842,6 +842,8 @@ int mv88e6390_serdes_power(struct mv88e6xxx_chip *chip, int port, int lane,
>  	case MV88E6XXX_PORT_STS_CMODE_RXAUI:
>  		err = mv88e6390_serdes_power_10g(chip, lane, up);
>  		break;
> +	default:
> +		return -EINVAL;
>  	}
>  
>  	if (!err && up)
> @@ -1507,7 +1509,7 @@ int mv88e6393x_serdes_power(struct mv88e6xxx_chip *chip, int port, int lane,
>  			    bool on)
>  {
>  	u8 cmode = chip->ports[port].cmode;
> -	int err = 0;
> +	int err;
>  
>  	if (port != 0 && port != 9 && port != 10)
>  		return -EOPNOTSUPP;
> @@ -1541,6 +1543,8 @@ int mv88e6393x_serdes_power(struct mv88e6xxx_chip *chip, int port, int lane,
>  	case MV88E6393X_PORT_STS_CMODE_10GBASER:
>  		err = mv88e6390_serdes_power_10g(chip, lane, on);
>  		break;
> +	default:
> +		return -EINVAL;
>  	}
>  
>  	if (err)
> -- 
> 2.25.1
>
Hi Marek,

I checked serdes.c and I found two methods mv88e6390_serdes_power() and
mv88e6390_serdes_power() that were not returning ENINVAL in case of
undefined cmode. Would be appreciated if  you can review the patch
please.

Best Regards,
Ameer Hamza.

  reply	other threads:[~2021-12-08 14:10 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-06 11:32 [PATCH] net: dsa: mv88e6xxx: initialize return variable on declaration Ameer Hamza
2021-12-06 13:21 ` Andrew Lunn
2021-12-06 22:29   ` Marek Behún
2021-12-07  0:25     ` Jakub Kicinski
2021-12-07 13:06       ` Marek Behún
2021-12-08 14:04         ` [PATCH v2] net: dsa: mv88e6xxx: error handling for serdes_power functions Ameer Hamza
2021-12-08 14:09           ` Ameer Hamza [this message]
2021-12-08 15:04             ` Jakub Kicinski
2021-12-08 15:40           ` Marek Behún
2021-12-08 15:58             ` [PATCH v3] " Ameer Hamza
2021-12-08 16:18               ` Marek Behún
2021-12-09  1:28               ` Jakub Kicinski
2021-12-09  4:06                 ` Ameer Hamza
2021-12-09  4:07         ` [PATCH v4] " Ameer Hamza
2021-12-09  4:15           ` Ameer Hamza
2021-12-09 15:50             ` patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211208140957.GA96979@hamza-OptiPlex-7040 \
    --to=amhamza.mgc@gmail.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=f.fainelli@gmail.com \
    --cc=kabel@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=olteanv@gmail.com \
    --cc=vivien.didelot@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.