summaryrefslogtreecommitdiff
path: root/drivers/acpi/bus.c
diff options
context:
space:
mode:
authorMichal Wilczynski <michal.wilczynski@intel.com>2023-07-03 11:02:45 +0300
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2023-07-14 19:58:34 +0300
commit0d16710146a10cf62b3efddee8ffd006432d5d7e (patch)
tree8e52a5609ffbe51629a31c7f2b7c450e14019054 /drivers/acpi/bus.c
parentc542ce36a9f0bbf7c3a607ee31f1c39fda280782 (diff)
downloadlinux-0d16710146a10cf62b3efddee8ffd006432d5d7e.tar.xz
ACPI: bus: Set driver_data to NULL every time .add() fails
Most ACPI drivers set driver_data in their .add() callbacks, but usually they don't clear it in the error code path. Set driver_data to NULL in acpi_device_probe() to prevent stale pointers from staying around. Signed-off-by: Michal Wilczynski <michal.wilczynski@intel.com> [ rjw: Subject and changelog edits ] Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/acpi/bus.c')
-rw-r--r--drivers/acpi/bus.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c
index b5688839be1b..0168b3a556b6 100644
--- a/drivers/acpi/bus.c
+++ b/drivers/acpi/bus.c
@@ -1029,8 +1029,10 @@ static int acpi_device_probe(struct device *dev)
return -ENOSYS;
ret = acpi_drv->ops.add(acpi_dev);
- if (ret)
+ if (ret) {
+ acpi_dev->driver_data = NULL;
return ret;
+ }
pr_debug("Driver [%s] successfully bound to device [%s]\n",
acpi_drv->name, acpi_dev->pnp.bus_id);