diff options
| author | Linux Build Service Account <lnxbuild@localhost> | 2018-06-16 18:58:02 -0700 |
|---|---|---|
| committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2018-06-16 18:58:01 -0700 |
| commit | 2df37432879423de0fd90bc659a1b3369abf1951 (patch) | |
| tree | 6805df89aa918b723e4003c8add7962fa89020dd | |
| parent | e4340a3ea8f12bcc2a1c3a4cf3212772f97c3f44 (diff) | |
| parent | a6672f6af9009ed68e431211e683f1d29a57b40e (diff) | |
Merge "soc: qcom: subsystem_restart: Add checks to verify validity of a device"
| -rw-r--r-- | drivers/soc/qcom/subsystem_restart.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/drivers/soc/qcom/subsystem_restart.c b/drivers/soc/qcom/subsystem_restart.c index ae249f382339..ea94456ccef8 100644 --- a/drivers/soc/qcom/subsystem_restart.c +++ b/drivers/soc/qcom/subsystem_restart.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2011-2017, The Linux Foundation. All rights reserved. +/* Copyright (c) 2011-2018, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -1083,7 +1083,7 @@ int subsystem_restart_dev(struct subsys_device *dev) { const char *name; - if (!get_device(&dev->dev)) + if ((!dev) || !get_device(&dev->dev)) return -ENODEV; if (!try_module_get(dev->owner)) { @@ -1177,11 +1177,21 @@ EXPORT_SYMBOL(subsystem_crashed); void subsys_set_crash_status(struct subsys_device *dev, enum crash_status crashed) { + if (!dev) { + pr_err("Invalid subsystem device\n"); + return; + } + dev->crashed = crashed; } enum crash_status subsys_get_crash_status(struct subsys_device *dev) { + if (!dev) { + pr_err("Invalid subsystem device\n"); + return CRASH_STATUS_NO_CRASH; + } + return dev->crashed; } |
