summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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);