Skip to content

Commit fb76ea1

Browse files
idoschkuba-moo
authored andcommitted
mlxsw: core_thermal: Make mlxsw_thermal_module_{init, fini} symmetric
mlxsw_thermal_module_fini() de-initializes the module's thermal zone, but mlxsw_thermal_module_init() does not initialize it. Make both functions symmetric by moving the initialization of the module's thermal zone to mlxsw_thermal_module_init(). Signed-off-by: Ido Schimmel <[email protected]> Reviewed-by: Vadim Pasternak <[email protected]> Signed-off-by: Petr Machata <[email protected]> Reviewed-by: Wojciech Drewek <[email protected]> Link: https://patch.msgid.link/a661ad468f8ad0d7d533d8334e4abf61dfe34342.1722345311.git.petrm@nvidia.com Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 73c18f9 commit fb76ea1

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

drivers/net/ethernet/mellanox/mlxsw/core_thermal.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,7 @@ static void mlxsw_thermal_module_tz_fini(struct thermal_zone_device *tzdev)
445445
thermal_zone_device_unregister(tzdev);
446446
}
447447

448-
static void
448+
static int
449449
mlxsw_thermal_module_init(struct mlxsw_thermal *thermal,
450450
struct mlxsw_thermal_area *area, u8 module)
451451
{
@@ -461,6 +461,8 @@ mlxsw_thermal_module_init(struct mlxsw_thermal *thermal,
461461
sizeof(thermal->trips));
462462
memcpy(module_tz->cooling_states, default_cooling_states,
463463
sizeof(thermal->cooling_states));
464+
465+
return mlxsw_thermal_module_tz_init(module_tz);
464466
}
465467

466468
static void mlxsw_thermal_module_fini(struct mlxsw_thermal_module *module_tz)
@@ -477,7 +479,6 @@ mlxsw_thermal_modules_init(struct device *dev, struct mlxsw_core *core,
477479
struct mlxsw_thermal *thermal,
478480
struct mlxsw_thermal_area *area)
479481
{
480-
struct mlxsw_thermal_module *module_tz;
481482
char mgpir_pl[MLXSW_REG_MGPIR_LEN];
482483
int i, err;
483484

@@ -500,16 +501,14 @@ mlxsw_thermal_modules_init(struct device *dev, struct mlxsw_core *core,
500501
return -ENOMEM;
501502

502503
for (i = 0; i < area->tz_module_num; i++) {
503-
mlxsw_thermal_module_init(thermal, area, i);
504-
module_tz = &area->tz_module_arr[i];
505-
err = mlxsw_thermal_module_tz_init(module_tz);
504+
err = mlxsw_thermal_module_init(thermal, area, i);
506505
if (err)
507-
goto err_thermal_module_tz_init;
506+
goto err_thermal_module_init;
508507
}
509508

510509
return 0;
511510

512-
err_thermal_module_tz_init:
511+
err_thermal_module_init:
513512
for (i = area->tz_module_num - 1; i >= 0; i--)
514513
mlxsw_thermal_module_fini(&area->tz_module_arr[i]);
515514
kfree(area->tz_module_arr);

0 commit comments

Comments
 (0)