linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH][next] net: dsa: sja1105: Fix assigned yet unused return code rc
@ 2021-06-09 17:43 Colin King
  2021-06-09 18:00 ` Vladimir Oltean
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Colin King @ 2021-06-09 17:43 UTC (permalink / raw)
  To: Vladimir Oltean, Andrew Lunn, Vivien Didelot, Florian Fainelli,
	David S . Miller, Jakub Kicinski, netdev
  Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

The return code variable rc is being set to return error values in two
places in sja1105_mdiobus_base_tx_register and yet it is not being
returned, the function always returns 0 instead. Fix this by replacing
the return 0 with the return code rc.

Addresses-Coverity: ("Unused value")
Fixes: 5a8f09748ee7 ("net: dsa: sja1105: register the MDIO buses for 100base-T1 and 100base-TX")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/net/dsa/sja1105/sja1105_mdio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/dsa/sja1105/sja1105_mdio.c b/drivers/net/dsa/sja1105/sja1105_mdio.c
index 8dfd06318b23..08517c70cb48 100644
--- a/drivers/net/dsa/sja1105/sja1105_mdio.c
+++ b/drivers/net/dsa/sja1105/sja1105_mdio.c
@@ -171,7 +171,7 @@ static int sja1105_mdiobus_base_tx_register(struct sja1105_private *priv,
 out_put_np:
 	of_node_put(np);
 
-	return 0;
+	return rc;
 }
 
 static void sja1105_mdiobus_base_tx_unregister(struct sja1105_private *priv)
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH][next] net: dsa: sja1105: Fix assigned yet unused return code rc
  2021-06-09 17:43 [PATCH][next] net: dsa: sja1105: Fix assigned yet unused return code rc Colin King
@ 2021-06-09 18:00 ` Vladimir Oltean
  2021-06-09 22:50 ` patchwork-bot+netdevbpf
  2021-06-10  6:23 ` Dan Carpenter
  2 siblings, 0 replies; 6+ messages in thread
From: Vladimir Oltean @ 2021-06-09 18:00 UTC (permalink / raw)
  To: Colin King
  Cc: Andrew Lunn, Vivien Didelot, Florian Fainelli, David S . Miller,
	Jakub Kicinski, netdev, kernel-janitors, linux-kernel

On Wed, Jun 09, 2021 at 06:43:53PM +0100, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> The return code variable rc is being set to return error values in two
> places in sja1105_mdiobus_base_tx_register and yet it is not being
> returned, the function always returns 0 instead. Fix this by replacing
> the return 0 with the return code rc.
> 
> Addresses-Coverity: ("Unused value")
> Fixes: 5a8f09748ee7 ("net: dsa: sja1105: register the MDIO buses for 100base-T1 and 100base-TX")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---

Reviewed-by: Vladimir Oltean <olteanv@gmail.com>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH][next] net: dsa: sja1105: Fix assigned yet unused return code rc
  2021-06-09 17:43 [PATCH][next] net: dsa: sja1105: Fix assigned yet unused return code rc Colin King
  2021-06-09 18:00 ` Vladimir Oltean
@ 2021-06-09 22:50 ` patchwork-bot+netdevbpf
  2021-06-10  6:23 ` Dan Carpenter
  2 siblings, 0 replies; 6+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-06-09 22:50 UTC (permalink / raw)
  To: Colin King
  Cc: olteanv, andrew, vivien.didelot, f.fainelli, davem, kuba, netdev,
	kernel-janitors, linux-kernel

Hello:

This patch was applied to netdev/net-next.git (refs/heads/master):

On Wed,  9 Jun 2021 18:43:53 +0100 you wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> The return code variable rc is being set to return error values in two
> places in sja1105_mdiobus_base_tx_register and yet it is not being
> returned, the function always returns 0 instead. Fix this by replacing
> the return 0 with the return code rc.
> 
> [...]

Here is the summary with links:
  - [next] net: dsa: sja1105: Fix assigned yet unused return code rc
    https://git.kernel.org/netdev/net-next/c/ab324d8dfdda

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH][next] net: dsa: sja1105: Fix assigned yet unused return code rc
  2021-06-09 17:43 [PATCH][next] net: dsa: sja1105: Fix assigned yet unused return code rc Colin King
  2021-06-09 18:00 ` Vladimir Oltean
  2021-06-09 22:50 ` patchwork-bot+netdevbpf
@ 2021-06-10  6:23 ` Dan Carpenter
  2021-06-10 17:51   ` Vladimir Oltean
  2 siblings, 1 reply; 6+ messages in thread
From: Dan Carpenter @ 2021-06-10  6:23 UTC (permalink / raw)
  To: Colin King
  Cc: Vladimir Oltean, Andrew Lunn, Vivien Didelot, Florian Fainelli,
	David S . Miller, Jakub Kicinski, netdev, kernel-janitors,
	linux-kernel

On Wed, Jun 09, 2021 at 06:43:53PM +0100, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> The return code variable rc is being set to return error values in two
> places in sja1105_mdiobus_base_tx_register and yet it is not being
> returned, the function always returns 0 instead. Fix this by replacing
> the return 0 with the return code rc.
> 
> Addresses-Coverity: ("Unused value")
> Fixes: 5a8f09748ee7 ("net: dsa: sja1105: register the MDIO buses for 100base-T1 and 100base-TX")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  drivers/net/dsa/sja1105/sja1105_mdio.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/dsa/sja1105/sja1105_mdio.c b/drivers/net/dsa/sja1105/sja1105_mdio.c
> index 8dfd06318b23..08517c70cb48 100644
> --- a/drivers/net/dsa/sja1105/sja1105_mdio.c
> +++ b/drivers/net/dsa/sja1105/sja1105_mdio.c
> @@ -171,7 +171,7 @@ static int sja1105_mdiobus_base_tx_register(struct sja1105_private *priv,
>  out_put_np:
>  	of_node_put(np);
>  
> -	return 0;
> +	return rc;

Should this function really return success if of_device_is_available()?

regards,
dan carpenter


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH][next] net: dsa: sja1105: Fix assigned yet unused return code rc
  2021-06-10  6:23 ` Dan Carpenter
@ 2021-06-10 17:51   ` Vladimir Oltean
  2021-06-10 18:19     ` Dan Carpenter
  0 siblings, 1 reply; 6+ messages in thread
From: Vladimir Oltean @ 2021-06-10 17:51 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Colin King, Andrew Lunn, Vivien Didelot, Florian Fainelli,
	David S . Miller, Jakub Kicinski, netdev, kernel-janitors,
	linux-kernel

On Thu, Jun 10, 2021 at 09:23:58AM +0300, Dan Carpenter wrote:
> On Wed, Jun 09, 2021 at 06:43:53PM +0100, Colin King wrote:
> > From: Colin Ian King <colin.king@canonical.com>
> > 
> > The return code variable rc is being set to return error values in two
> > places in sja1105_mdiobus_base_tx_register and yet it is not being
> > returned, the function always returns 0 instead. Fix this by replacing
> > the return 0 with the return code rc.
> > 
> > Addresses-Coverity: ("Unused value")
> > Fixes: 5a8f09748ee7 ("net: dsa: sja1105: register the MDIO buses for 100base-T1 and 100base-TX")
> > Signed-off-by: Colin Ian King <colin.king@canonical.com>
> > ---
> >  drivers/net/dsa/sja1105/sja1105_mdio.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/net/dsa/sja1105/sja1105_mdio.c b/drivers/net/dsa/sja1105/sja1105_mdio.c
> > index 8dfd06318b23..08517c70cb48 100644
> > --- a/drivers/net/dsa/sja1105/sja1105_mdio.c
> > +++ b/drivers/net/dsa/sja1105/sja1105_mdio.c
> > @@ -171,7 +171,7 @@ static int sja1105_mdiobus_base_tx_register(struct sja1105_private *priv,
> >  out_put_np:
> >  	of_node_put(np);
> >  
> > -	return 0;
> > +	return rc;
> 
> Should this function really return success if of_device_is_available()?

If _not_ of_device_is_available you mean? Yup. Nothing wrong with not
having an internal MDIO bus. This is a driver which supports switches
that do and switches that don't, and even if the node exists, it may
have status = "disabled", which is again fine.
Or am I misunderstanding the question?

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH][next] net: dsa: sja1105: Fix assigned yet unused return code rc
  2021-06-10 17:51   ` Vladimir Oltean
@ 2021-06-10 18:19     ` Dan Carpenter
  0 siblings, 0 replies; 6+ messages in thread
From: Dan Carpenter @ 2021-06-10 18:19 UTC (permalink / raw)
  To: Vladimir Oltean
  Cc: Colin King, Andrew Lunn, Vivien Didelot, Florian Fainelli,
	David S . Miller, Jakub Kicinski, netdev, kernel-janitors,
	linux-kernel

On Thu, Jun 10, 2021 at 08:51:24PM +0300, Vladimir Oltean wrote:
> On Thu, Jun 10, 2021 at 09:23:58AM +0300, Dan Carpenter wrote:
> > On Wed, Jun 09, 2021 at 06:43:53PM +0100, Colin King wrote:
> > > From: Colin Ian King <colin.king@canonical.com>
> > > 
> > > The return code variable rc is being set to return error values in two
> > > places in sja1105_mdiobus_base_tx_register and yet it is not being
> > > returned, the function always returns 0 instead. Fix this by replacing
> > > the return 0 with the return code rc.
> > > 
> > > Addresses-Coverity: ("Unused value")
> > > Fixes: 5a8f09748ee7 ("net: dsa: sja1105: register the MDIO buses for 100base-T1 and 100base-TX")
> > > Signed-off-by: Colin Ian King <colin.king@canonical.com>
> > > ---
> > >  drivers/net/dsa/sja1105/sja1105_mdio.c | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > > 
> > > diff --git a/drivers/net/dsa/sja1105/sja1105_mdio.c b/drivers/net/dsa/sja1105/sja1105_mdio.c
> > > index 8dfd06318b23..08517c70cb48 100644
> > > --- a/drivers/net/dsa/sja1105/sja1105_mdio.c
> > > +++ b/drivers/net/dsa/sja1105/sja1105_mdio.c
> > > @@ -171,7 +171,7 @@ static int sja1105_mdiobus_base_tx_register(struct sja1105_private *priv,
> > >  out_put_np:
> > >  	of_node_put(np);
> > >  
> > > -	return 0;
> > > +	return rc;
> > 
> > Should this function really return success if of_device_is_available()?
> 
> If _not_ of_device_is_available you mean? Yup. Nothing wrong with not
> having an internal MDIO bus. This is a driver which supports switches
> that do and switches that don't, and even if the node exists, it may
> have status = "disabled", which is again fine.
> Or am I misunderstanding the question?

Yeah.  I left out the "!".  That answers the question.  Thanks!

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-06-10 18:20 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-09 17:43 [PATCH][next] net: dsa: sja1105: Fix assigned yet unused return code rc Colin King
2021-06-09 18:00 ` Vladimir Oltean
2021-06-09 22:50 ` patchwork-bot+netdevbpf
2021-06-10  6:23 ` Dan Carpenter
2021-06-10 17:51   ` Vladimir Oltean
2021-06-10 18:19     ` Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).