net/mlx5: Return -EOPNOTSUPP in mlx5_devlink_port_fn_migratable_set() directly
authorJiri Pirko <jiri@nvidia.com>
Thu, 1 Jun 2023 12:16:41 +0000 (14:16 +0200)
committerSaeed Mahameed <saeedm@nvidia.com>
Wed, 23 Aug 2023 04:34:17 +0000 (21:34 -0700)
Instead of initializing "err" variable, just return "-EOPNOTSUPP"
directly where it is needed.

Signed-off-by: Jiri Pirko <jiri@nvidia.com>
Reviewed-by: Shay Drory <shayd@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c

index 609605c42d6d7c713f3515cb434c86e1085358f9..87cc6ad2e17fd85ddf0e580f38118e0b80e4672a 100644 (file)
@@ -4309,7 +4309,7 @@ int mlx5_devlink_port_fn_migratable_set(struct devlink_port *port, bool enable,
        struct mlx5_vport *vport;
        void *query_ctx;
        void *hca_caps;
-       int err = -EOPNOTSUPP;
+       int err;
 
        esw = mlx5_devlink_eswitch_get(port->devlink);
        if (IS_ERR(esw))
@@ -4317,7 +4317,7 @@ int mlx5_devlink_port_fn_migratable_set(struct devlink_port *port, bool enable,
 
        if (!MLX5_CAP_GEN(esw->dev, migration)) {
                NL_SET_ERR_MSG_MOD(extack, "Device doesn't support migration");
-               return err;
+               return -EOPNOTSUPP;
        }
 
        vport = mlx5_devlink_port_fn_get_vport(port, esw);