@@ -356,16 +356,18 @@ static int cpufreq_governor_init(struct cpufreq_policy *policy,
356
356
if (!have_governor_per_policy ())
357
357
cdata -> gdbs_data = dbs_data ;
358
358
359
+ policy -> governor_data = dbs_data ;
360
+
359
361
ret = sysfs_create_group (get_governor_parent_kobj (policy ),
360
362
get_sysfs_attr (dbs_data ));
361
363
if (ret )
362
364
goto reset_gdbs_data ;
363
365
364
- policy -> governor_data = dbs_data ;
365
-
366
366
return 0 ;
367
367
368
368
reset_gdbs_data :
369
+ policy -> governor_data = NULL ;
370
+
369
371
if (!have_governor_per_policy ())
370
372
cdata -> gdbs_data = NULL ;
371
373
cdata -> exit (dbs_data , !policy -> governor -> initialized );
@@ -386,16 +388,19 @@ static int cpufreq_governor_exit(struct cpufreq_policy *policy,
386
388
if (!cdbs -> shared || cdbs -> shared -> policy )
387
389
return - EBUSY ;
388
390
389
- policy -> governor_data = NULL ;
390
391
if (!-- dbs_data -> usage_count ) {
391
392
sysfs_remove_group (get_governor_parent_kobj (policy ),
392
393
get_sysfs_attr (dbs_data ));
393
394
395
+ policy -> governor_data = NULL ;
396
+
394
397
if (!have_governor_per_policy ())
395
398
cdata -> gdbs_data = NULL ;
396
399
397
400
cdata -> exit (dbs_data , policy -> governor -> initialized == 1 );
398
401
kfree (dbs_data );
402
+ } else {
403
+ policy -> governor_data = NULL ;
399
404
}
400
405
401
406
free_common_dbs_info (policy , cdata );
0 commit comments