@@ -445,7 +445,7 @@ static void mlxsw_thermal_module_tz_fini(struct thermal_zone_device *tzdev)
445
445
thermal_zone_device_unregister (tzdev );
446
446
}
447
447
448
- static void
448
+ static int
449
449
mlxsw_thermal_module_init (struct mlxsw_thermal * thermal ,
450
450
struct mlxsw_thermal_area * area , u8 module )
451
451
{
@@ -461,6 +461,8 @@ mlxsw_thermal_module_init(struct mlxsw_thermal *thermal,
461
461
sizeof (thermal -> trips ));
462
462
memcpy (module_tz -> cooling_states , default_cooling_states ,
463
463
sizeof (thermal -> cooling_states ));
464
+
465
+ return mlxsw_thermal_module_tz_init (module_tz );
464
466
}
465
467
466
468
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,
477
479
struct mlxsw_thermal * thermal ,
478
480
struct mlxsw_thermal_area * area )
479
481
{
480
- struct mlxsw_thermal_module * module_tz ;
481
482
char mgpir_pl [MLXSW_REG_MGPIR_LEN ];
482
483
int i , err ;
483
484
@@ -500,16 +501,14 @@ mlxsw_thermal_modules_init(struct device *dev, struct mlxsw_core *core,
500
501
return - ENOMEM ;
501
502
502
503
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 );
506
505
if (err )
507
- goto err_thermal_module_tz_init ;
506
+ goto err_thermal_module_init ;
508
507
}
509
508
510
509
return 0 ;
511
510
512
- err_thermal_module_tz_init :
511
+ err_thermal_module_init :
513
512
for (i = area -> tz_module_num - 1 ; i >= 0 ; i -- )
514
513
mlxsw_thermal_module_fini (& area -> tz_module_arr [i ]);
515
514
kfree (area -> tz_module_arr );
0 commit comments