Commit c633e799 authored by Leon Romanovsky's avatar Leon Romanovsky Committed by Saeed Mahameed

net/mlx5: Don't skip subfunction cleanup in case of error in module init

Clean SF resources if mlx5 eth failed to initialize.

Fixes: 1958fc2f ("net/mlx5: SF, Add auxiliary device driver")
Signed-off-by: default avatarLeon Romanovsky <leonro@nvidia.com>
Reviewed-by: default avatarParav Pandit <parav@nvidia.com>
Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
parent d09c548d
...@@ -1784,16 +1784,14 @@ static int __init init(void) ...@@ -1784,16 +1784,14 @@ static int __init init(void)
if (err) if (err)
goto err_sf; goto err_sf;
#ifdef CONFIG_MLX5_CORE_EN
err = mlx5e_init(); err = mlx5e_init();
if (err) { if (err)
pci_unregister_driver(&mlx5_core_driver); goto err_en;
goto err_debug;
}
#endif
return 0; return 0;
err_en:
mlx5_sf_driver_unregister();
err_sf: err_sf:
pci_unregister_driver(&mlx5_core_driver); pci_unregister_driver(&mlx5_core_driver);
err_debug: err_debug:
...@@ -1803,9 +1801,7 @@ static int __init init(void) ...@@ -1803,9 +1801,7 @@ static int __init init(void)
static void __exit cleanup(void) static void __exit cleanup(void)
{ {
#ifdef CONFIG_MLX5_CORE_EN
mlx5e_cleanup(); mlx5e_cleanup();
#endif
mlx5_sf_driver_unregister(); mlx5_sf_driver_unregister();
pci_unregister_driver(&mlx5_core_driver); pci_unregister_driver(&mlx5_core_driver);
mlx5_unregister_debugfs(); mlx5_unregister_debugfs();
......
...@@ -206,8 +206,13 @@ int mlx5_firmware_flash(struct mlx5_core_dev *dev, const struct firmware *fw, ...@@ -206,8 +206,13 @@ int mlx5_firmware_flash(struct mlx5_core_dev *dev, const struct firmware *fw,
int mlx5_fw_version_query(struct mlx5_core_dev *dev, int mlx5_fw_version_query(struct mlx5_core_dev *dev,
u32 *running_ver, u32 *stored_ver); u32 *running_ver, u32 *stored_ver);
#ifdef CONFIG_MLX5_CORE_EN
int mlx5e_init(void); int mlx5e_init(void);
void mlx5e_cleanup(void); void mlx5e_cleanup(void);
#else
static inline int mlx5e_init(void){ return 0; }
static inline void mlx5e_cleanup(void){}
#endif
static inline bool mlx5_sriov_is_enabled(struct mlx5_core_dev *dev) static inline bool mlx5_sriov_is_enabled(struct mlx5_core_dev *dev)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment