linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] smsc911x: remove superfluous variable init
@ 2023-03-21 11:47 Wolfram Sang
  2023-03-21 14:27 ` Geert Uytterhoeven
  0 siblings, 1 reply; 5+ messages in thread
From: Wolfram Sang @ 2023-03-21 11:47 UTC (permalink / raw)
  To: netdev
  Cc: linux-renesas-soc, Wolfram Sang, Steve Glendinning,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	linux-kernel

phydev is assigned a value right away, no need to initialize it.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
 drivers/net/ethernet/smsc/smsc911x.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/smsc/smsc911x.c b/drivers/net/ethernet/smsc/smsc911x.c
index 25e867b74185..037a2b6b89d7 100644
--- a/drivers/net/ethernet/smsc/smsc911x.c
+++ b/drivers/net/ethernet/smsc/smsc911x.c
@@ -1016,7 +1016,7 @@ static void smsc911x_phy_adjust_link(struct net_device *dev)
 static int smsc911x_mii_probe(struct net_device *dev)
 {
 	struct smsc911x_data *pdata = netdev_priv(dev);
-	struct phy_device *phydev = NULL;
+	struct phy_device *phydev;
 	int ret;
 
 	phydev = phy_find_first(pdata->mii_bus);
-- 
2.30.2


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

* Re: [PATCH net-next] smsc911x: remove superfluous variable init
  2023-03-21 11:47 [PATCH net-next] smsc911x: remove superfluous variable init Wolfram Sang
@ 2023-03-21 14:27 ` Geert Uytterhoeven
  2023-03-21 14:38   ` Wolfram Sang
  0 siblings, 1 reply; 5+ messages in thread
From: Geert Uytterhoeven @ 2023-03-21 14:27 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: netdev, linux-renesas-soc, Steve Glendinning, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, linux-kernel

Hi Wolfram,

On Tue, Mar 21, 2023 at 12:50 PM Wolfram Sang
<wsa+renesas@sang-engineering.com> wrote:
> phydev is assigned a value right away, no need to initialize it.
>
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

Thanks for your patch!

Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>

> --- a/drivers/net/ethernet/smsc/smsc911x.c
> +++ b/drivers/net/ethernet/smsc/smsc911x.c
> @@ -1016,7 +1016,7 @@ static void smsc911x_phy_adjust_link(struct net_device *dev)
>  static int smsc911x_mii_probe(struct net_device *dev)
>  {
>         struct smsc911x_data *pdata = netdev_priv(dev);
> -       struct phy_device *phydev = NULL;
> +       struct phy_device *phydev;
>         int ret;
>
>         phydev = phy_find_first(pdata->mii_bus);

Nit: perhaps combine this assignment with the variable declaration?

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: [PATCH net-next] smsc911x: remove superfluous variable init
  2023-03-21 14:27 ` Geert Uytterhoeven
@ 2023-03-21 14:38   ` Wolfram Sang
  2023-03-21 19:27     ` Jakub Kicinski
  2023-03-22 14:58     ` Paolo Abeni
  0 siblings, 2 replies; 5+ messages in thread
From: Wolfram Sang @ 2023-03-21 14:38 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: netdev, linux-renesas-soc, Steve Glendinning, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 387 bytes --]


> >         struct smsc911x_data *pdata = netdev_priv(dev);
> > -       struct phy_device *phydev = NULL;
> > +       struct phy_device *phydev;
> >         int ret;
> >
> >         phydev = phy_find_first(pdata->mii_bus);
> 
> Nit: perhaps combine this assignment with the variable declaration?

I thought about it but found this version to be easier readable.

Thanks!


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH net-next] smsc911x: remove superfluous variable init
  2023-03-21 14:38   ` Wolfram Sang
@ 2023-03-21 19:27     ` Jakub Kicinski
  2023-03-22 14:58     ` Paolo Abeni
  1 sibling, 0 replies; 5+ messages in thread
From: Jakub Kicinski @ 2023-03-21 19:27 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: Geert Uytterhoeven, netdev, linux-renesas-soc, Steve Glendinning,
	David S. Miller, Eric Dumazet, Paolo Abeni, linux-kernel

On Tue, 21 Mar 2023 15:38:31 +0100 Wolfram Sang wrote:
> > >         struct smsc911x_data *pdata = netdev_priv(dev);
> > > -       struct phy_device *phydev = NULL;
> > > +       struct phy_device *phydev;
> > >         int ret;
> > >
> > >         phydev = phy_find_first(pdata->mii_bus);  
> > 
> > Nit: perhaps combine this assignment with the variable declaration?  
> 
> I thought about it but found this version to be easier readable.

+1 

Calling functions which need their return value error-checked as part
of the variable declaration should be against the kernel coding style
IMHO.

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

* Re: [PATCH net-next] smsc911x: remove superfluous variable init
  2023-03-21 14:38   ` Wolfram Sang
  2023-03-21 19:27     ` Jakub Kicinski
@ 2023-03-22 14:58     ` Paolo Abeni
  1 sibling, 0 replies; 5+ messages in thread
From: Paolo Abeni @ 2023-03-22 14:58 UTC (permalink / raw)
  To: Wolfram Sang, Geert Uytterhoeven
  Cc: netdev, linux-renesas-soc, Steve Glendinning, David S. Miller,
	Eric Dumazet, Jakub Kicinski, linux-kernel

On Tue, 2023-03-21 at 15:38 +0100, Wolfram Sang wrote:
> > >         struct smsc911x_data *pdata = netdev_priv(dev);
> > > -       struct phy_device *phydev = NULL;
> > > +       struct phy_device *phydev;
> > >         int ret;
> > > 
> > >         phydev = phy_find_first(pdata->mii_bus);
> > 
> > Nit: perhaps combine this assignment with the variable declaration?
> 
> I thought about it but found this version to be easier readable.

This patch does not apply cleanly to net-next, please rebase and
resping.

Thanks!

Paolo


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

end of thread, other threads:[~2023-03-22 14:59 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-21 11:47 [PATCH net-next] smsc911x: remove superfluous variable init Wolfram Sang
2023-03-21 14:27 ` Geert Uytterhoeven
2023-03-21 14:38   ` Wolfram Sang
2023-03-21 19:27     ` Jakub Kicinski
2023-03-22 14:58     ` Paolo Abeni

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).