diff mbox series

[net-next] funeth: remove pointless check of devlink pointer in create/destroy_netdev() flows

Message ID 20220826110411.1409446-1-jiri@resnulli.us (mailing list archive)
State Accepted
Commit 4f99de7b181f926a3f8d71fec74fd80e2ee8d9c2
Delegated to: Netdev Maintainers
Headers show
Series [net-next] funeth: remove pointless check of devlink pointer in create/destroy_netdev() flows | expand

Checks

Context Check Description
netdev/tree_selection success Clearly marked for net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix success Link
netdev/cover_letter success Single patches do not need cover letters
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers success CCed 7 of 7 maintainers
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 30 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Jiri Pirko Aug. 26, 2022, 11:04 a.m. UTC
From: Jiri Pirko <jiri@nvidia.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@nvidia.com>
---
 drivers/net/ethernet/fungible/funeth/funeth_main.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

Comments

Dimitris Michailidis Aug. 26, 2022, 7:01 p.m. UTC | #1
On Fri, Aug 26, 2022 at 4:04 AM Jiri Pirko <jiri@resnulli.us> wrote:
>
> From: Jiri Pirko <jiri@nvidia.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@nvidia.com>

Thanks for the patch.

Acked-by: Dimitris Michailidis <dmichail@fungible.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
>
patchwork-bot+netdevbpf@kernel.org Aug. 31, 2022, 6 a.m. UTC | #2
Hello:

This patch was applied to netdev/net-next.git (master)
by Jakub Kicinski <kuba@kernel.org>:

On Fri, 26 Aug 2022 13:04:11 +0200 you wrote:
> From: Jiri Pirko <jiri@nvidia.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@nvidia.com>
> 
> [...]

Here is the summary with links:
  - [net-next] funeth: remove pointless check of devlink pointer in create/destroy_netdev() flows
    https://git.kernel.org/netdev/net-next/c/4f99de7b181f

You are awesome, thank you!
diff mbox series

Patch

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