@@ -184,15 +184,14 @@ static void tt_add_tz_work_fn(struct work_struct *work)
184184
185185int tt_add_tz (void )
186186{
187- struct tt_thermal_zone * tt_zone __free (kfree );
188- struct tt_work * tt_work __free (kfree ) = NULL ;
189187 int ret ;
190188
191- tt_zone = kzalloc (sizeof (* tt_zone ), GFP_KERNEL );
189+ struct tt_thermal_zone * tt_zone __free (kfree ) = kzalloc (sizeof (* tt_zone ),
190+ GFP_KERNEL );
192191 if (!tt_zone )
193192 return - ENOMEM ;
194193
195- tt_work = kzalloc (sizeof (* tt_work ), GFP_KERNEL );
194+ struct tt_work * tt_work __free ( kfree ) = kzalloc (sizeof (* tt_work ), GFP_KERNEL );
196195 if (!tt_work )
197196 return - ENOMEM ;
198197
@@ -237,7 +236,6 @@ static void tt_zone_unregister_tz(struct tt_thermal_zone *tt_zone)
237236
238237int tt_del_tz (const char * arg )
239238{
240- struct tt_work * tt_work __free (kfree ) = NULL ;
241239 struct tt_thermal_zone * tt_zone , * aux ;
242240 int ret ;
243241 int id ;
@@ -246,7 +244,7 @@ int tt_del_tz(const char *arg)
246244 if (ret != 1 )
247245 return - EINVAL ;
248246
249- tt_work = kzalloc (sizeof (* tt_work ), GFP_KERNEL );
247+ struct tt_work * tt_work __free ( kfree ) = kzalloc (sizeof (* tt_work ), GFP_KERNEL );
250248 if (!tt_work )
251249 return - ENOMEM ;
252250
@@ -330,20 +328,17 @@ static void tt_zone_add_trip_work_fn(struct work_struct *work)
330328
331329int tt_zone_add_trip (const char * arg )
332330{
333- struct tt_thermal_zone * tt_zone __free (put_tt_zone ) = NULL ;
334- struct tt_trip * tt_trip __free (kfree ) = NULL ;
335- struct tt_work * tt_work __free (kfree );
336331 int id ;
337332
338- tt_work = kzalloc (sizeof (* tt_work ), GFP_KERNEL );
333+ struct tt_work * tt_work __free ( kfree ) = kzalloc (sizeof (* tt_work ), GFP_KERNEL );
339334 if (!tt_work )
340335 return - ENOMEM ;
341336
342- tt_trip = kzalloc (sizeof (* tt_trip ), GFP_KERNEL );
337+ struct tt_trip * tt_trip __free ( kfree ) = kzalloc (sizeof (* tt_trip ), GFP_KERNEL );
343338 if (!tt_trip )
344339 return - ENOMEM ;
345340
346- tt_zone = tt_get_tt_zone (arg );
341+ struct tt_thermal_zone * tt_zone __free ( put_tt_zone ) = tt_get_tt_zone (arg );
347342 if (IS_ERR (tt_zone ))
348343 return PTR_ERR (tt_zone );
349344
@@ -387,7 +382,6 @@ static const struct thermal_zone_device_ops tt_zone_ops = {
387382
388383static int tt_zone_register_tz (struct tt_thermal_zone * tt_zone )
389384{
390- struct thermal_trip * trips __free (kfree ) = NULL ;
391385 struct thermal_zone_device * tz ;
392386 struct tt_trip * tt_trip ;
393387 int i ;
@@ -397,7 +391,8 @@ static int tt_zone_register_tz(struct tt_thermal_zone *tt_zone)
397391 if (tt_zone -> tz )
398392 return - EINVAL ;
399393
400- trips = kcalloc (tt_zone -> num_trips , sizeof (* trips ), GFP_KERNEL );
394+ struct thermal_trip * trips __free (kfree ) = kcalloc (tt_zone -> num_trips ,
395+ sizeof (* trips ), GFP_KERNEL );
401396 if (!trips )
402397 return - ENOMEM ;
403398
@@ -421,9 +416,7 @@ static int tt_zone_register_tz(struct tt_thermal_zone *tt_zone)
421416
422417int tt_zone_reg (const char * arg )
423418{
424- struct tt_thermal_zone * tt_zone __free (put_tt_zone );
425-
426- tt_zone = tt_get_tt_zone (arg );
419+ struct tt_thermal_zone * tt_zone __free (put_tt_zone ) = tt_get_tt_zone (arg );
427420 if (IS_ERR (tt_zone ))
428421 return PTR_ERR (tt_zone );
429422
@@ -432,9 +425,7 @@ int tt_zone_reg(const char *arg)
432425
433426int tt_zone_unreg (const char * arg )
434427{
435- struct tt_thermal_zone * tt_zone __free (put_tt_zone );
436-
437- tt_zone = tt_get_tt_zone (arg );
428+ struct tt_thermal_zone * tt_zone __free (put_tt_zone ) = tt_get_tt_zone (arg );
438429 if (IS_ERR (tt_zone ))
439430 return PTR_ERR (tt_zone );
440431
0 commit comments