Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'pm-fixes'

* pm-fixes:
cpufreq: fix NULL pointer deference at od_set_powersave_bias()

+13 -4
+13 -4
drivers/cpufreq/cpufreq_ondemand.c
··· 47 47 static struct cpufreq_governor cpufreq_gov_ondemand; 48 48 #endif 49 49 50 + static unsigned int default_powersave_bias; 51 + 50 52 static void ondemand_powersave_bias_init_cpu(int cpu) 51 53 { 52 54 struct od_cpu_dbs_info_s *dbs_info = &per_cpu(od_cpu_dbs_info, cpu); ··· 545 543 546 544 tuners->sampling_down_factor = DEF_SAMPLING_DOWN_FACTOR; 547 545 tuners->ignore_nice = 0; 548 - tuners->powersave_bias = 0; 546 + tuners->powersave_bias = default_powersave_bias; 549 547 tuners->io_is_busy = should_io_be_busy(); 550 548 551 549 dbs_data->tuners = tuners; ··· 587 585 unsigned int cpu; 588 586 cpumask_t done; 589 587 588 + default_powersave_bias = powersave_bias; 590 589 cpumask_clear(&done); 591 590 592 591 get_online_cpus(); ··· 596 593 continue; 597 594 598 595 policy = per_cpu(od_cpu_dbs_info, cpu).cdbs.cur_policy; 599 - dbs_data = policy->governor_data; 600 - od_tuners = dbs_data->tuners; 601 - od_tuners->powersave_bias = powersave_bias; 596 + if (!policy) 597 + continue; 602 598 603 599 cpumask_or(&done, &done, policy->cpus); 600 + 601 + if (policy->governor != &cpufreq_gov_ondemand) 602 + continue; 603 + 604 + dbs_data = policy->governor_data; 605 + od_tuners = dbs_data->tuners; 606 + od_tuners->powersave_bias = default_powersave_bias; 604 607 } 605 608 put_online_cpus(); 606 609 }