mlxsw: core_thermal: Rename labels according to naming convention
authorVadim Pasternak <vadimp@nvidia.com>
Tue, 22 Feb 2022 17:16:56 +0000 (19:16 +0200)
committerDavid S. Miller <davem@davemloft.net>
Wed, 23 Feb 2022 12:38:17 +0000 (12:38 +0000)
Rename labels for error flow handling in order to align with naming
convention used in rest of 'mlxsw' code.

Signed-off-by: Vadim Pasternak <vadimp@nvidia.com>
Reviewed-by: Jiri Pirko <jiri@nvidia.com>
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mellanox/mlxsw/core_thermal.c

index e20ac2b..784f9c7 100644 (file)
@@ -392,11 +392,11 @@ static int mlxsw_thermal_module_bind(struct thermal_zone_device *tzdev,
                                                       trip->min_state,
                                                       THERMAL_WEIGHT_DEFAULT);
                if (err < 0)
-                       goto err_bind_cooling_device;
+                       goto err_thermal_zone_bind_cooling_device;
        }
        return 0;
 
-err_bind_cooling_device:
+err_thermal_zone_bind_cooling_device:
        for (j = i - 1; j >= 0; j--)
                thermal_zone_unbind_cooling_device(tzdev, j, cdev);
        return err;
@@ -766,7 +766,7 @@ mlxsw_thermal_modules_init(struct device *dev, struct mlxsw_core *core,
        for (i = 0; i < thermal->tz_module_num; i++) {
                err = mlxsw_thermal_module_init(dev, core, thermal, i);
                if (err)
-                       goto err_unreg_tz_module_arr;
+                       goto err_thermal_module_init;
        }
 
        for (i = 0; i < thermal->tz_module_num; i++) {
@@ -775,12 +775,13 @@ mlxsw_thermal_modules_init(struct device *dev, struct mlxsw_core *core,
                        continue;
                err = mlxsw_thermal_module_tz_init(module_tz);
                if (err)
-                       goto err_unreg_tz_module_arr;
+                       goto err_thermal_module_tz_init;
        }
 
        return 0;
 
-err_unreg_tz_module_arr:
+err_thermal_module_tz_init:
+err_thermal_module_init:
        for (i = thermal->tz_module_num - 1; i >= 0; i--)
                mlxsw_thermal_module_fini(&thermal->tz_module_arr[i]);
        kfree(thermal->tz_module_arr);
@@ -871,12 +872,12 @@ mlxsw_thermal_gearboxes_init(struct device *dev, struct mlxsw_core *core,
                gearbox_tz->parent = thermal;
                err = mlxsw_thermal_gearbox_tz_init(gearbox_tz);
                if (err)
-                       goto err_unreg_tz_gearbox;
+                       goto err_thermal_gearbox_tz_init;
        }
 
        return 0;
 
-err_unreg_tz_gearbox:
+err_thermal_gearbox_tz_init:
        for (i--; i >= 0; i--)
                mlxsw_thermal_gearbox_tz_fini(&thermal->tz_gearbox_arr[i]);
        kfree(thermal->tz_gearbox_arr);
@@ -920,7 +921,7 @@ int mlxsw_thermal_init(struct mlxsw_core *core,
        err = mlxsw_reg_query(thermal->core, MLXSW_REG(mfcr), mfcr_pl);
        if (err) {
                dev_err(dev, "Failed to probe PWMs\n");
-               goto err_free_thermal;
+               goto err_reg_query;
        }
        mlxsw_reg_mfcr_unpack(mfcr_pl, &freq, &tacho_active, &pwm_active);
 
@@ -934,14 +935,14 @@ int mlxsw_thermal_init(struct mlxsw_core *core,
                        err = mlxsw_reg_query(thermal->core, MLXSW_REG(mfsl),
                                              mfsl_pl);
                        if (err)
-                               goto err_free_thermal;
+                               goto err_reg_query;
 
                        /* set the minimal RPMs to 0 */
                        mlxsw_reg_mfsl_tach_min_set(mfsl_pl, 0);
                        err = mlxsw_reg_write(thermal->core, MLXSW_REG(mfsl),
                                              mfsl_pl);
                        if (err)
-                               goto err_free_thermal;
+                               goto err_reg_write;
                }
        }
        for (i = 0; i < MLXSW_MFCR_PWMS_MAX; i++) {
@@ -954,7 +955,7 @@ int mlxsw_thermal_init(struct mlxsw_core *core,
                        if (IS_ERR(cdev)) {
                                err = PTR_ERR(cdev);
                                dev_err(dev, "Failed to register cooling device\n");
-                               goto err_unreg_cdevs;
+                               goto err_thermal_cooling_device_register;
                        }
                        thermal->cdevs[i] = cdev;
                }
@@ -978,38 +979,40 @@ int mlxsw_thermal_init(struct mlxsw_core *core,
        if (IS_ERR(thermal->tzdev)) {
                err = PTR_ERR(thermal->tzdev);
                dev_err(dev, "Failed to register thermal zone\n");
-               goto err_unreg_cdevs;
+               goto err_thermal_zone_device_register;
        }
 
        err = mlxsw_thermal_modules_init(dev, core, thermal);
        if (err)
-               goto err_unreg_tzdev;
+               goto err_thermal_modules_init;
 
        err = mlxsw_thermal_gearboxes_init(dev, core, thermal);
        if (err)
-               goto err_unreg_modules_tzdev;
+               goto err_thermal_gearboxes_init;
 
        err = thermal_zone_device_enable(thermal->tzdev);
        if (err)
-               goto err_unreg_gearboxes;
+               goto err_thermal_zone_device_enable;
 
        *p_thermal = thermal;
        return 0;
 
-err_unreg_gearboxes:
+err_thermal_zone_device_enable:
        mlxsw_thermal_gearboxes_fini(thermal);
-err_unreg_modules_tzdev:
+err_thermal_gearboxes_init:
        mlxsw_thermal_modules_fini(thermal);
-err_unreg_tzdev:
+err_thermal_modules_init:
        if (thermal->tzdev) {
                thermal_zone_device_unregister(thermal->tzdev);
                thermal->tzdev = NULL;
        }
-err_unreg_cdevs:
+err_thermal_zone_device_register:
+err_thermal_cooling_device_register:
        for (i = 0; i < MLXSW_MFCR_PWMS_MAX; i++)
                if (thermal->cdevs[i])
                        thermal_cooling_device_unregister(thermal->cdevs[i]);
-err_free_thermal:
+err_reg_write:
+err_reg_query:
        devm_kfree(dev, thermal);
        return err;
 }