#ifndef COLORIZE_H #define COLORIZE_H #define colorize_start(fore) "\033[" __##fore "m" #define colorize_start_full(fore, back) "\033[" __##fore ";" __on_##back "m" #define colorize_end() "\033[" __reset "m" #endif /* COLORIZE_H */ favicon.ico'/>
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrendan Jackman <brendan.jackman@arm.com>2016-08-17 16:14:59 +0100
committerZhang Rui <rui.zhang@intel.com>2016-08-19 21:32:18 +0800
commita305a4387acb01cecadeeea5151c049a022a1bfc (patch)
tree4563fb3c6b8956491b1326ba5ec3d160b9850fda
parent694d0d0bb2030d2e36df73e2d23d5770511dbc8d (diff)
thermal: cpu_cooling: Fix NULL dereference in cpufreq_state2power
Currently all CPU cooling devices share a `struct thermal_cooling_device_ops` instance. The thermal core uses the presence of functions in this struct to determine if a cooling device has a power model (see cdev_is_power_actor). cpu_cooling.c adds the power model functions to the shared struct when a device is registered with a power model. Therefore, if a CPU cooling device is registered using [of_]cpufreq_power_cooling_register, _all_ devices will be determined to have a power model, including any registered with [of_]cpufreq_cooling_register. This can result in cpufreq_state2power being called on a device where dyn_power_table is NULL. With this commit, instead of having a shared thermal_cooling_device_ops which is mutated, we have two versions: one with the power functions and one without. Signed-off-by: Brendan Jackman <brendan.jackman@arm.com> Cc: Amit Daniel Kachhap <amit.kachhap@gmail.com> Cc: Viresh Kumar <viresh.kumar@linaro.org> Cc: Javi Merino <javi.merino@arm.com> Acked-by: Viresh Kumar <viresh.kumar@linaro.org> Acked-by: Javi Merino <javi.merino@arm.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>