Commit 009da9fa authored by Vadim Pasternak's avatar Vadim Pasternak Committed by David S. Miller
Browse files

mlxsw: core_thermal: Rename labels according to naming convention



Rename labels for error flow handling in order to align with naming
convention used in rest of 'mlxsw' code.

Signed-off-by: default avatarVadim Pasternak <vadimp@nvidia.com>
Reviewed-by: default avatarJiri Pirko <jiri@nvidia.com>
Signed-off-by: default avatarIdo Schimmel <idosch@nvidia.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent bed8f419
Loading
Loading
Loading
Loading
+23 −20
Original line number Original line Diff line number Diff line
@@ -392,11 +392,11 @@ static int mlxsw_thermal_module_bind(struct thermal_zone_device *tzdev,
						       trip->min_state,
						       trip->min_state,
						       THERMAL_WEIGHT_DEFAULT);
						       THERMAL_WEIGHT_DEFAULT);
		if (err < 0)
		if (err < 0)
			goto err_bind_cooling_device;
			goto err_thermal_zone_bind_cooling_device;
	}
	}
	return 0;
	return 0;


err_bind_cooling_device:
err_thermal_zone_bind_cooling_device:
	for (j = i - 1; j >= 0; j--)
	for (j = i - 1; j >= 0; j--)
		thermal_zone_unbind_cooling_device(tzdev, j, cdev);
		thermal_zone_unbind_cooling_device(tzdev, j, cdev);
	return err;
	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++) {
	for (i = 0; i < thermal->tz_module_num; i++) {
		err = mlxsw_thermal_module_init(dev, core, thermal, i);
		err = mlxsw_thermal_module_init(dev, core, thermal, i);
		if (err)
		if (err)
			goto err_unreg_tz_module_arr;
			goto err_thermal_module_init;
	}
	}


	for (i = 0; i < thermal->tz_module_num; i++) {
	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;
			continue;
		err = mlxsw_thermal_module_tz_init(module_tz);
		err = mlxsw_thermal_module_tz_init(module_tz);
		if (err)
		if (err)
			goto err_unreg_tz_module_arr;
			goto err_thermal_module_tz_init;
	}
	}


	return 0;
	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--)
	for (i = thermal->tz_module_num - 1; i >= 0; i--)
		mlxsw_thermal_module_fini(&thermal->tz_module_arr[i]);
		mlxsw_thermal_module_fini(&thermal->tz_module_arr[i]);
	kfree(thermal->tz_module_arr);
	kfree(thermal->tz_module_arr);
@@ -871,12 +872,12 @@ mlxsw_thermal_gearboxes_init(struct device *dev, struct mlxsw_core *core,
		gearbox_tz->parent = thermal;
		gearbox_tz->parent = thermal;
		err = mlxsw_thermal_gearbox_tz_init(gearbox_tz);
		err = mlxsw_thermal_gearbox_tz_init(gearbox_tz);
		if (err)
		if (err)
			goto err_unreg_tz_gearbox;
			goto err_thermal_gearbox_tz_init;
	}
	}


	return 0;
	return 0;


err_unreg_tz_gearbox:
err_thermal_gearbox_tz_init:
	for (i--; i >= 0; i--)
	for (i--; i >= 0; i--)
		mlxsw_thermal_gearbox_tz_fini(&thermal->tz_gearbox_arr[i]);
		mlxsw_thermal_gearbox_tz_fini(&thermal->tz_gearbox_arr[i]);
	kfree(thermal->tz_gearbox_arr);
	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);
	err = mlxsw_reg_query(thermal->core, MLXSW_REG(mfcr), mfcr_pl);
	if (err) {
	if (err) {
		dev_err(dev, "Failed to probe PWMs\n");
		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);
	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),
			err = mlxsw_reg_query(thermal->core, MLXSW_REG(mfsl),
					      mfsl_pl);
					      mfsl_pl);
			if (err)
			if (err)
				goto err_free_thermal;
				goto err_reg_query;


			/* set the minimal RPMs to 0 */
			/* set the minimal RPMs to 0 */
			mlxsw_reg_mfsl_tach_min_set(mfsl_pl, 0);
			mlxsw_reg_mfsl_tach_min_set(mfsl_pl, 0);
			err = mlxsw_reg_write(thermal->core, MLXSW_REG(mfsl),
			err = mlxsw_reg_write(thermal->core, MLXSW_REG(mfsl),
					      mfsl_pl);
					      mfsl_pl);
			if (err)
			if (err)
				goto err_free_thermal;
				goto err_reg_write;
		}
		}
	}
	}
	for (i = 0; i < MLXSW_MFCR_PWMS_MAX; i++) {
	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)) {
			if (IS_ERR(cdev)) {
				err = PTR_ERR(cdev);
				err = PTR_ERR(cdev);
				dev_err(dev, "Failed to register cooling device\n");
				dev_err(dev, "Failed to register cooling device\n");
				goto err_unreg_cdevs;
				goto err_thermal_cooling_device_register;
			}
			}
			thermal->cdevs[i] = cdev;
			thermal->cdevs[i] = cdev;
		}
		}
@@ -978,38 +979,40 @@ int mlxsw_thermal_init(struct mlxsw_core *core,
	if (IS_ERR(thermal->tzdev)) {
	if (IS_ERR(thermal->tzdev)) {
		err = PTR_ERR(thermal->tzdev);
		err = PTR_ERR(thermal->tzdev);
		dev_err(dev, "Failed to register thermal zone\n");
		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);
	err = mlxsw_thermal_modules_init(dev, core, thermal);
	if (err)
	if (err)
		goto err_unreg_tzdev;
		goto err_thermal_modules_init;


	err = mlxsw_thermal_gearboxes_init(dev, core, thermal);
	err = mlxsw_thermal_gearboxes_init(dev, core, thermal);
	if (err)
	if (err)
		goto err_unreg_modules_tzdev;
		goto err_thermal_gearboxes_init;


	err = thermal_zone_device_enable(thermal->tzdev);
	err = thermal_zone_device_enable(thermal->tzdev);
	if (err)
	if (err)
		goto err_unreg_gearboxes;
		goto err_thermal_zone_device_enable;


	*p_thermal = thermal;
	*p_thermal = thermal;
	return 0;
	return 0;


err_unreg_gearboxes:
err_thermal_zone_device_enable:
	mlxsw_thermal_gearboxes_fini(thermal);
	mlxsw_thermal_gearboxes_fini(thermal);
err_unreg_modules_tzdev:
err_thermal_gearboxes_init:
	mlxsw_thermal_modules_fini(thermal);
	mlxsw_thermal_modules_fini(thermal);
err_unreg_tzdev:
err_thermal_modules_init:
	if (thermal->tzdev) {
	if (thermal->tzdev) {
		thermal_zone_device_unregister(thermal->tzdev);
		thermal_zone_device_unregister(thermal->tzdev);
		thermal->tzdev = NULL;
		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++)
	for (i = 0; i < MLXSW_MFCR_PWMS_MAX; i++)
		if (thermal->cdevs[i])
		if (thermal->cdevs[i])
			thermal_cooling_device_unregister(thermal->cdevs[i]);
			thermal_cooling_device_unregister(thermal->cdevs[i]);
err_free_thermal:
err_reg_write:
err_reg_query:
	devm_kfree(dev, thermal);
	devm_kfree(dev, thermal);
	return err;
	return err;
}
}