Skip to content

Commit

Permalink
mlxsw: core_thermal: Rename labels according to naming convention
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
vadimp-nvidia authored and davem330 committed Feb 23, 2022
1 parent bed8f41 commit 009da9f
Showing 1 changed file with 23 additions and 20 deletions.
43 changes: 23 additions & 20 deletions drivers/net/ethernet/mellanox/mlxsw/core_thermal.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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++) {
Expand All @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);

Expand All @@ -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++) {
Expand All @@ -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;
}
Expand All @@ -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;
}
Expand Down

0 comments on commit 009da9f

Please sign in to comment.