diff options
author | Leon Romanovsky <leonro@nvidia.com> | 2021-09-25 14:22:57 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2021-09-27 16:31:59 +0100 |
commit | 71c1b525934d5a50b404457d9eb7aa2c6d6b21a6 (patch) | |
tree | 92aa4908c68e312bc89edccf7e9c62a217ba7d83 /drivers/net/netdevsim/dev.c | |
parent | 0d98ff22de92e164915596dde6fc22ab4a8bd704 (diff) | |
download | linux-71c1b525934d5a50b404457d9eb7aa2c6d6b21a6.tar.gz linux-71c1b525934d5a50b404457d9eb7aa2c6d6b21a6.tar.bz2 linux-71c1b525934d5a50b404457d9eb7aa2c6d6b21a6.zip |
netdevsim: Move devlink registration to be last devlink command
This change prevents from users to access device before devlink is
fully configured.
Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/netdevsim/dev.c')
-rw-r--r-- | drivers/net/netdevsim/dev.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/drivers/net/netdevsim/dev.c b/drivers/net/netdevsim/dev.c index b2214bc9efe2..cb6645012a30 100644 --- a/drivers/net/netdevsim/dev.c +++ b/drivers/net/netdevsim/dev.c @@ -1470,7 +1470,6 @@ int nsim_dev_probe(struct nsim_bus_dev *nsim_bus_dev) if (err) goto err_devlink_free; - devlink_register(devlink); err = devlink_params_register(devlink, nsim_devlink_params, ARRAY_SIZE(nsim_devlink_params)); if (err) @@ -1511,9 +1510,9 @@ int nsim_dev_probe(struct nsim_bus_dev *nsim_bus_dev) if (err) goto err_psample_exit; - devlink_params_publish(devlink); - devlink_reload_enable(devlink); nsim_dev->esw_mode = DEVLINK_ESWITCH_MODE_LEGACY; + devlink_register(devlink); + devlink_reload_enable(devlink); return 0; err_psample_exit: @@ -1534,7 +1533,6 @@ err_params_unregister: devlink_params_unregister(devlink, nsim_devlink_params, ARRAY_SIZE(nsim_devlink_params)); err_dl_unregister: - devlink_unregister(devlink); devlink_resources_unregister(devlink, NULL); err_devlink_free: devlink_free(devlink); @@ -1569,6 +1567,7 @@ void nsim_dev_remove(struct nsim_bus_dev *nsim_bus_dev) struct devlink *devlink = priv_to_devlink(nsim_dev); devlink_reload_disable(devlink); + devlink_unregister(devlink); nsim_dev_reload_destroy(nsim_dev); @@ -1576,7 +1575,6 @@ void nsim_dev_remove(struct nsim_bus_dev *nsim_bus_dev) nsim_dev_debugfs_exit(nsim_dev); devlink_params_unregister(devlink, nsim_devlink_params, ARRAY_SIZE(nsim_devlink_params)); - devlink_unregister(devlink); devlink_resources_unregister(devlink, NULL); devlink_free(devlink); } |