soc: qcom: core_ctl: Fix possible null-pointer dereference
Ensure we don't try to call online/offline functions with a null-pointer. CRs-fixed: 1049957 Change-Id: I6fa8f9bde5d5fd0680b5c571ba3cc99bd1f508b1 Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
This commit is contained in:
parent
60aacdb787
commit
b4f6cd620b
1 changed files with 14 additions and 8 deletions
|
@ -72,22 +72,28 @@ EXPORT_SYMBOL(core_ctl_find_cpu_device);
|
|||
|
||||
int __ref core_ctl_online_core(unsigned int cpu)
|
||||
{
|
||||
int ret;
|
||||
int ret = -EINVAL;
|
||||
struct device *dev = get_cpu_device(cpu);
|
||||
|
||||
lock_device_hotplug();
|
||||
ret = device_online(get_cpu_device(cpu));
|
||||
unlock_device_hotplug();
|
||||
if (dev) {
|
||||
lock_device_hotplug();
|
||||
ret = device_online(dev);
|
||||
unlock_device_hotplug();
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL(core_ctl_online_core);
|
||||
|
||||
int __ref core_ctl_offline_core(unsigned int cpu)
|
||||
{
|
||||
int ret;
|
||||
int ret = -EINVAL;
|
||||
struct device *dev = get_cpu_device(cpu);
|
||||
|
||||
lock_device_hotplug();
|
||||
ret = device_offline(get_cpu_device(cpu));
|
||||
unlock_device_hotplug();
|
||||
if (dev) {
|
||||
lock_device_hotplug();
|
||||
ret = device_offline(dev);
|
||||
unlock_device_hotplug();
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL(core_ctl_offline_core);
|
||||
|
|
Loading…
Add table
Reference in a new issue