Skip to content

Commit d81d714

Browse files
idoschkuba-moo
authored andcommitted
mlxsw: core_thermal: Fold two loops into one
There is no need to traverse the same array twice. Do it once by folding both loops into one. 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/81756744ed532aaa9249a83fc08757accfe8b07c.1722345311.git.petrm@nvidia.com Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 2a1c9dc commit d81d714

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -500,10 +500,8 @@ mlxsw_thermal_modules_init(struct device *dev, struct mlxsw_core *core,
500500
if (!area->tz_module_arr)
501501
return -ENOMEM;
502502

503-
for (i = 0; i < area->tz_module_num; i++)
504-
mlxsw_thermal_module_init(dev, core, thermal, area, i);
505-
506503
for (i = 0; i < area->tz_module_num; i++) {
504+
mlxsw_thermal_module_init(dev, core, thermal, area, i);
507505
module_tz = &area->tz_module_arr[i];
508506
err = mlxsw_thermal_module_tz_init(module_tz);
509507
if (err)

0 commit comments

Comments
 (0)