Skip to content

Commit

Permalink
funeth: remove pointless check of devlink pointer in create/destroy_n…
Browse files Browse the repository at this point in the history
…etdev() flows

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>
Acked-by: Dimitris Michailidis <dmichail@fungible.com>
Link: https://lore.kernel.org/r/20220826110411.1409446-1-jiri@resnulli.us
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
  • Loading branch information
Jiri Pirko authored and Jakub Kicinski committed Aug 31, 2022
1 parent 1390d91 commit 4f99de7
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions drivers/net/ethernet/fungible/funeth/funeth_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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);
Expand Down

0 comments on commit 4f99de7

Please sign in to comment.