[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAOkoqZnX2bGtvb6Keajo7Edy5G6Joc=CSxNfNrgbeYmXT=BA+A@mail.gmail.com>
Date: Fri, 26 Aug 2022 12:01:56 -0700
From: Dimitris Michailidis <d.michailidis@...gible.com>
To: Jiri Pirko <jiri@...nulli.us>
Cc: Networking <netdev@...r.kernel.org>,
"David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>, pabeni@...hat.com,
edumazet@...gle.com, Dimitrios Michailidis <dmichail@...gible.com>
Subject: Re: [patch net-next] funeth: remove pointless check of devlink
pointer in create/destroy_netdev() flows
On Fri, Aug 26, 2022 at 4:04 AM Jiri Pirko <jiri@...nulli.us> wrote:
>
> From: Jiri Pirko <jiri@...dia.com>
>
> Once devlink port is successfully registered, the devlink pointer is not
> NULL. Therefore, the check is going to be always true and therefore
> pointless. Remove it.
>
> Signed-off-by: Jiri Pirko <jiri@...dia.com>
Thanks for the patch.
Acked-by: Dimitris Michailidis <dmichail@...gible.com>
> ---
> drivers/net/ethernet/fungible/funeth/funeth_main.c | 12 ++++--------
> 1 file changed, 4 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/net/ethernet/fungible/funeth/funeth_main.c b/drivers/net/ethernet/fungible/funeth/funeth_main.c
> index f247b7ad3a88..b6de2ad82a32 100644
> --- a/drivers/net/ethernet/fungible/funeth/funeth_main.c
> +++ b/drivers/net/ethernet/fungible/funeth/funeth_main.c
> @@ -1802,16 +1802,14 @@ static int fun_create_netdev(struct fun_ethdev *ed, unsigned int portid)
> if (rc)
> goto unreg_devlink;
>
> - if (fp->dl_port.devlink)
> - devlink_port_type_eth_set(&fp->dl_port, netdev);
> + devlink_port_type_eth_set(&fp->dl_port, netdev);
>
> return 0;
>
> unreg_devlink:
> ed->netdevs[portid] = NULL;
> fun_ktls_cleanup(fp);
> - if (fp->dl_port.devlink)
> - devlink_port_unregister(&fp->dl_port);
> + devlink_port_unregister(&fp->dl_port);
> free_stats:
> fun_free_stats_area(fp);
> free_rss:
> @@ -1830,10 +1828,8 @@ static void fun_destroy_netdev(struct net_device *netdev)
> struct funeth_priv *fp;
>
> fp = netdev_priv(netdev);
> - if (fp->dl_port.devlink) {
> - devlink_port_type_clear(&fp->dl_port);
> - devlink_port_unregister(&fp->dl_port);
> - }
> + devlink_port_type_clear(&fp->dl_port);
> + devlink_port_unregister(&fp->dl_port);
> unregister_netdev(netdev);
> fun_ktls_cleanup(fp);
> fun_free_stats_area(fp);
> --
> 2.37.1
>
Powered by blists - more mailing lists