netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next 1/1] plca.c: fix obvious mistake in checking retval
@ 2023-01-11 17:30 Piergiorgio Beruto
  2023-01-12 12:51 ` Andrew Lunn
  2023-01-12 14:45 ` Eric Dumazet
  0 siblings, 2 replies; 4+ messages in thread
From: Piergiorgio Beruto @ 2023-01-11 17:30 UTC (permalink / raw)
  To: Andrew Lunn, Heiner Kallweit, Russell King, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: linux-kernel, netdev, Oleksij Rempel, mailhol.vincent,
	sudheer.mogilappagari, sbhatta, linux-doc, wangjie125, corbet,
	lkp, gal, gustavoars, bagasdotme

This patch addresses a wrong fix that was done during the review
process. The intention was to substitute "if(ret < 0)" with
"if(ret)". Unfortunately, in this specific file the intended fix did not
meet the code.

Signed-off-by: Piergiorgio Beruto <piergiorgio.beruto@gmail.com>
---
 net/ethtool/plca.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/net/ethtool/plca.c b/net/ethtool/plca.c
index d9bb13ffc654..9c7d29186b4e 100644
--- a/net/ethtool/plca.c
+++ b/net/ethtool/plca.c
@@ -61,7 +61,7 @@ static int plca_get_cfg_prepare_data(const struct ethnl_req_info *req_base,
 	}
 
 	ret = ethnl_ops_begin(dev);
-	if (!ret)
+	if (ret)
 		goto out;
 
 	memset(&data->plca_cfg, 0xff,
@@ -151,7 +151,7 @@ int ethnl_set_plca_cfg(struct sk_buff *skb, struct genl_info *info)
 					 tb[ETHTOOL_A_PLCA_HEADER],
 					 genl_info_net(info), info->extack,
 					 true);
-	if (!ret)
+	if (ret)
 		return ret;
 
 	dev = req_info.dev;
@@ -171,7 +171,7 @@ int ethnl_set_plca_cfg(struct sk_buff *skb, struct genl_info *info)
 	}
 
 	ret = ethnl_ops_begin(dev);
-	if (!ret)
+	if (ret)
 		goto out_rtnl;
 
 	memset(&plca_cfg, 0xff, sizeof(plca_cfg));
@@ -189,7 +189,7 @@ int ethnl_set_plca_cfg(struct sk_buff *skb, struct genl_info *info)
 		goto out_ops;
 
 	ret = ops->set_plca_cfg(dev->phydev, &plca_cfg, info->extack);
-	if (!ret)
+	if (ret)
 		goto out_ops;
 
 	ethtool_notify(dev, ETHTOOL_MSG_PLCA_NTF, NULL);
@@ -233,7 +233,7 @@ static int plca_get_status_prepare_data(const struct ethnl_req_info *req_base,
 	}
 
 	ret = ethnl_ops_begin(dev);
-	if (!ret)
+	if (ret)
 		goto out;
 
 	memset(&data->plca_st, 0xff,
-- 
2.37.4


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

* Re: [PATCH net-next 1/1] plca.c: fix obvious mistake in checking retval
  2023-01-11 17:30 [PATCH net-next 1/1] plca.c: fix obvious mistake in checking retval Piergiorgio Beruto
@ 2023-01-12 12:51 ` Andrew Lunn
  2023-01-12 14:45 ` Eric Dumazet
  1 sibling, 0 replies; 4+ messages in thread
From: Andrew Lunn @ 2023-01-12 12:51 UTC (permalink / raw)
  To: Piergiorgio Beruto
  Cc: Heiner Kallweit, Russell King, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, linux-kernel, netdev, Oleksij Rempel,
	mailhol.vincent, sudheer.mogilappagari, sbhatta, linux-doc,
	wangjie125, corbet, lkp, gal, gustavoars, bagasdotme

On Wed, Jan 11, 2023 at 06:30:48PM +0100, Piergiorgio Beruto wrote:
> This patch addresses a wrong fix that was done during the review
> process. The intention was to substitute "if(ret < 0)" with
> "if(ret)". Unfortunately, in this specific file the intended fix did not
> meet the code.
> 
> Signed-off-by: Piergiorgio Beruto <piergiorgio.beruto@gmail.com>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew

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

* Re: [PATCH net-next 1/1] plca.c: fix obvious mistake in checking retval
  2023-01-11 17:30 [PATCH net-next 1/1] plca.c: fix obvious mistake in checking retval Piergiorgio Beruto
  2023-01-12 12:51 ` Andrew Lunn
@ 2023-01-12 14:45 ` Eric Dumazet
  2023-01-12 15:27   ` Piergiorgio Beruto
  1 sibling, 1 reply; 4+ messages in thread
From: Eric Dumazet @ 2023-01-12 14:45 UTC (permalink / raw)
  To: Piergiorgio Beruto
  Cc: Andrew Lunn, Heiner Kallweit, Russell King, David S. Miller,
	Jakub Kicinski, Paolo Abeni, linux-kernel, netdev, Oleksij Rempel,
	mailhol.vincent, sudheer.mogilappagari, sbhatta, linux-doc,
	wangjie125, corbet, lkp, gal, gustavoars, bagasdotme

On Wed, Jan 11, 2023 at 6:30 PM Piergiorgio Beruto
<piergiorgio.beruto@gmail.com> wrote:
>
> This patch addresses a wrong fix that was done during the review
> process. The intention was to substitute "if(ret < 0)" with
> "if(ret)". Unfortunately, in this specific file the intended fix did not
> meet the code.
>

Please add a Fixes: tag, even for a patch in net-next

Fixes: 8580e16c28f3 ("net/ethtool: add netlink interface for the PLCA RS")

> Signed-off-by: Piergiorgio Beruto <piergiorgio.beruto@gmail.com>
> ---
>  net/ethtool/plca.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/net/ethtool/plca.c b/net/ethtool/plca.c
> index d9bb13ffc654..9c7d29186b4e 100644
> --- a/net/ethtool/plca.c
> +++ b/net/ethtool/plca.c
> @@ -61,7 +61,7 @@ static int plca_get_cfg_prepare_data(const struct ethnl_req_info *req_base,
>         }
>
>         ret = ethnl_ops_begin(dev);
> -       if (!ret)
> +       if (ret)
>                 goto out;
>
>         memset(&data->plca_cfg, 0xff,
> @@ -151,7 +151,7 @@ int ethnl_set_plca_cfg(struct sk_buff *skb, struct genl_info *info)
>                                          tb[ETHTOOL_A_PLCA_HEADER],
>                                          genl_info_net(info), info->extack,
>                                          true);
> -       if (!ret)

Canonical way of testing an error from ethnl_parse_header_dev_get() is:

if (ret < 0)
    return ret;


Please double check for the rest of the patch (ethnl_ops_begin() ... )


> +       if (ret)
>                 return ret;
>
>         dev = req_info.dev;
> @@ -171,7 +171,7 @@ int ethnl_set_plca_cfg(struct sk_buff *skb, struct genl_info *info)
>         }
>
>         ret = ethnl_ops_begin(dev);
> -       if (!ret)
> +       if (ret)
>                 goto out_rtnl;
>
>         memset(&plca_cfg, 0xff, sizeof(plca_cfg));
> @@ -189,7 +189,7 @@ int ethnl_set_plca_cfg(struct sk_buff *skb, struct genl_info *info)
>                 goto out_ops;
>
>         ret = ops->set_plca_cfg(dev->phydev, &plca_cfg, info->extack);
> -       if (!ret)
> +       if (ret)
>                 goto out_ops;
>
>         ethtool_notify(dev, ETHTOOL_MSG_PLCA_NTF, NULL);
> @@ -233,7 +233,7 @@ static int plca_get_status_prepare_data(const struct ethnl_req_info *req_base,
>         }
>
>         ret = ethnl_ops_begin(dev);
> -       if (!ret)
> +       if (ret)
>                 goto out;
>
>         memset(&data->plca_st, 0xff,
> --
> 2.37.4
>

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

* Re: [PATCH net-next 1/1] plca.c: fix obvious mistake in checking retval
  2023-01-12 14:45 ` Eric Dumazet
@ 2023-01-12 15:27   ` Piergiorgio Beruto
  0 siblings, 0 replies; 4+ messages in thread
From: Piergiorgio Beruto @ 2023-01-12 15:27 UTC (permalink / raw)
  To: Eric Dumazet
  Cc: Andrew Lunn, Heiner Kallweit, Russell King, David S. Miller,
	Jakub Kicinski, Paolo Abeni, linux-kernel, netdev, Oleksij Rempel,
	mailhol.vincent, sudheer.mogilappagari, sbhatta, linux-doc,
	wangjie125, corbet, lkp, gal, gustavoars, bagasdotme

On Thu, Jan 12, 2023 at 03:45:03PM +0100, Eric Dumazet wrote:
> On Wed, Jan 11, 2023 at 6:30 PM Piergiorgio Beruto
> <piergiorgio.beruto@gmail.com> wrote:
> >
> > This patch addresses a wrong fix that was done during the review
> > process. The intention was to substitute "if(ret < 0)" with
> > "if(ret)". Unfortunately, in this specific file the intended fix did not
> > meet the code.
> >
> 
> Please add a Fixes: tag, even for a patch in net-next
Ok, will do, thanks!
> 
> Fixes: 8580e16c28f3 ("net/ethtool: add netlink interface for the PLCA RS")
> 
> > Signed-off-by: Piergiorgio Beruto <piergiorgio.beruto@gmail.com>
> > ---
> >  net/ethtool/plca.c | 10 +++++-----
> >  1 file changed, 5 insertions(+), 5 deletions(-)
> >
> > diff --git a/net/ethtool/plca.c b/net/ethtool/plca.c
> > index d9bb13ffc654..9c7d29186b4e 100644
> > --- a/net/ethtool/plca.c
> > +++ b/net/ethtool/plca.c
> > @@ -61,7 +61,7 @@ static int plca_get_cfg_prepare_data(const struct ethnl_req_info *req_base,
> >         }
> >
> >         ret = ethnl_ops_begin(dev);
> > -       if (!ret)
> > +       if (ret)
> >                 goto out;
> >
> >         memset(&data->plca_cfg, 0xff,
> > @@ -151,7 +151,7 @@ int ethnl_set_plca_cfg(struct sk_buff *skb, struct genl_info *info)
> >                                          tb[ETHTOOL_A_PLCA_HEADER],
> >                                          genl_info_net(info), info->extack,
> >                                          true);
> > -       if (!ret)
> 
> Canonical way of testing an error from ethnl_parse_header_dev_get() is:
> 
> if (ret < 0)
>     return ret;
> 
> 
> Please double check for the rest of the patch (ethnl_ops_begin() ... )
Ok, this is what I had originally. I changed that due to another review
comment. I'll revert this change.
> 
> 
> > +       if (ret)
> >                 return ret;
> >
> >         dev = req_info.dev;
> > @@ -171,7 +171,7 @@ int ethnl_set_plca_cfg(struct sk_buff *skb, struct genl_info *info)
> >         }
> >
> >         ret = ethnl_ops_begin(dev);
> > -       if (!ret)
> > +       if (ret)
> >                 goto out_rtnl;
> >
> >         memset(&plca_cfg, 0xff, sizeof(plca_cfg));
> > @@ -189,7 +189,7 @@ int ethnl_set_plca_cfg(struct sk_buff *skb, struct genl_info *info)
> >                 goto out_ops;
> >
> >         ret = ops->set_plca_cfg(dev->phydev, &plca_cfg, info->extack);
> > -       if (!ret)
> > +       if (ret)
> >                 goto out_ops;
> >
> >         ethtool_notify(dev, ETHTOOL_MSG_PLCA_NTF, NULL);
> > @@ -233,7 +233,7 @@ static int plca_get_status_prepare_data(const struct ethnl_req_info *req_base,
> >         }
> >
> >         ret = ethnl_ops_begin(dev);
> > -       if (!ret)
> > +       if (ret)
> >                 goto out;
> >
> >         memset(&data->plca_st, 0xff,
> > --
> > 2.37.4
> >
Thanks!
Piergiorgio

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

end of thread, other threads:[~2023-01-12 15:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-11 17:30 [PATCH net-next 1/1] plca.c: fix obvious mistake in checking retval Piergiorgio Beruto
2023-01-12 12:51 ` Andrew Lunn
2023-01-12 14:45 ` Eric Dumazet
2023-01-12 15:27   ` Piergiorgio Beruto

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