aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIdo Schimmel <[email protected]>2024-07-30 15:58:15 +0200
committerJakub Kicinski <[email protected]>2024-07-31 18:38:28 -0700
commitd81d71434036642882b55cf93432bf4a1720a481 (patch)
tree7fa43aad41d03f0ac0aceec3b7228e6776c22862
parent2a1c9dcb52ddc2916115e4a781f9f2a09c536d97 (diff)
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]>
-rw-r--r--drivers/net/ethernet/mellanox/mlxsw/core_thermal.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c b/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c
index afd8fe85a94d..b2a4eea859d1 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c
@@ -500,10 +500,8 @@ mlxsw_thermal_modules_init(struct device *dev, struct mlxsw_core *core,
if (!area->tz_module_arr)
return -ENOMEM;
- for (i = 0; i < area->tz_module_num; i++)
- mlxsw_thermal_module_init(dev, core, thermal, area, i);
-
for (i = 0; i < area->tz_module_num; i++) {
+ mlxsw_thermal_module_init(dev, core, thermal, area, i);
module_tz = &area->tz_module_arr[i];
err = mlxsw_thermal_module_tz_init(module_tz);
if (err)