Skip to content

Commit 0d16710

Browse files
mwilczyrafaeljw
authored andcommitted
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>
1 parent c542ce3 commit 0d16710

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

drivers/acpi/bus.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1029,8 +1029,10 @@ static int acpi_device_probe(struct device *dev)
10291029
return -ENOSYS;
10301030

10311031
ret = acpi_drv->ops.add(acpi_dev);
1032-
if (ret)
1032+
if (ret) {
1033+
acpi_dev->driver_data = NULL;
10331034
return ret;
1035+
}
10341036

10351037
pr_debug("Driver [%s] successfully bound to device [%s]\n",
10361038
acpi_drv->name, acpi_dev->pnp.bus_id);

0 commit comments

Comments
 (0)