summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinux Build Service Account <lnxbuild@localhost>2016-08-03 21:12:45 -0700
committerGerrit - the friendly Code Review server <code-review@localhost>2016-08-03 21:12:44 -0700
commit46e710a5ec34f2b21ed09c46ed031afc93bc5189 (patch)
tree641941bd686dc148fb44ad2710fc973fb09a7163
parent58f94dcd482273d8e3ca22f6ea904c81fff3c796 (diff)
parentb4f6cd620b681af699aec58e36c6ae2a94c9a80d (diff)
Merge "soc: qcom: core_ctl: Fix possible null-pointer dereference"
-rw-r--r--drivers/soc/qcom/core_ctl_helper.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/drivers/soc/qcom/core_ctl_helper.c b/drivers/soc/qcom/core_ctl_helper.c
index 3dde30d29a1c..88201412128e 100644
--- a/drivers/soc/qcom/core_ctl_helper.c
+++ b/drivers/soc/qcom/core_ctl_helper.c
@@ -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);