public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Maxime Chevallier <maxime.chevallier@bootlin.com>
To: Aleksandr Mishin <amishin@t-argos.ru>
Cc: Vadym Kochan <vadym.kochan@plvision.eu>,
	Taras Chornyi <taras.chornyi@plvision.eu>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Oleksandr Mazur <oleksandr.mazur@plvision.eu>,
	Serhiy Boiko <serhiy.boiko@plvision.eu>,
	Volodymyr Mytnyk <volodymyr.mytnyk@plvision.eu>,
	<netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<lvc-project@linuxtesting.org>
Subject: Re: [PATCH net] net: marvell: prestera: Remove unneeded check in prestera_port_create()
Date: Wed, 28 Aug 2024 16:03:15 +0200	[thread overview]
Message-ID: <20240828160315.077e3428@device-28.home> (raw)
In-Reply-To: <20240828132606.19878-1-amishin@t-argos.ru>

Hello Aleksandr,

On Wed, 28 Aug 2024 16:26:06 +0300
Aleksandr Mishin <amishin@t-argos.ru> wrote:

> prestera_port_create() calls prestera_rxtx_port_init() and analyze its
> return code. prestera_rxtx_port_init() always returns 0, so this check is
> unneeded and should be removed.
> 
> Remove unneeded check to clean up the code.
> 
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
> 
> Fixes: 501ef3066c89 ("net: marvell: prestera: Add driver for Prestera family ASIC devices")
> Signed-off-by: Aleksandr Mishin <amishin@t-argos.ru>
> ---
>  drivers/net/ethernet/marvell/prestera/prestera_main.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/net/ethernet/marvell/prestera/prestera_main.c b/drivers/net/ethernet/marvell/prestera/prestera_main.c
> index 63ae01954dfc..2d4f6d03b729 100644
> --- a/drivers/net/ethernet/marvell/prestera/prestera_main.c
> +++ b/drivers/net/ethernet/marvell/prestera/prestera_main.c
> @@ -718,9 +718,7 @@ static int prestera_port_create(struct prestera_switch *sw, u32 id)
>  		}
>  	}
>  
> -	err = prestera_rxtx_port_init(port);
> -	if (err)
> -		goto err_port_init;
> +	prestera_rxtx_port_init(port);

If this function always return 0, you might as well change it to return
void. This would avoid future issues if one were to change
prestera_rxtx_port_init() to acually make it return something. It would
then become obvious that the caller doesn't check the return, whereas
with the current patch, we are simply ignoring it.

I also think you can target that patch to net-next, this isn't fixing
any bug, but rather cleans the code up.

Thanks,

Maxime

      reply	other threads:[~2024-08-28 14:03 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-28 13:26 [PATCH net] net: marvell: prestera: Remove unneeded check in prestera_port_create() Aleksandr Mishin
2024-08-28 14:03 ` Maxime Chevallier [this message]

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=20240828160315.077e3428@device-28.home \
    --to=maxime.chevallier@bootlin.com \
    --cc=amishin@t-argos.ru \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lvc-project@linuxtesting.org \
    --cc=netdev@vger.kernel.org \
    --cc=oleksandr.mazur@plvision.eu \
    --cc=pabeni@redhat.com \
    --cc=serhiy.boiko@plvision.eu \
    --cc=taras.chornyi@plvision.eu \
    --cc=vadym.kochan@plvision.eu \
    --cc=volodymyr.mytnyk@plvision.eu \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox