Skip to content

Commit 37552f9

Browse files
geertugregkh
authored andcommitted
driver core: Print device when resources present in really_probe()
[ Upstream commit 7c35e69 ] If a device already has devres items attached before probing, a warning backtrace is printed. However, this backtrace does not reveal the offending device, leaving the user uninformed. Furthermore, using WARN_ON() causes systems with panic-on-warn to reboot. Fix this by replacing the WARN_ON() by a dev_crit() message. Abort probing the device, to prevent doing more damage to the device's resources. Signed-off-by: Geert Uytterhoeven <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent 34b95aa commit 37552f9

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

drivers/base/dd.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,10 @@ static int really_probe(struct device *dev, struct device_driver *drv)
341341
atomic_inc(&probe_count);
342342
pr_debug("bus: '%s': %s: probing driver %s with device %s\n",
343343
drv->bus->name, __func__, drv->name, dev_name(dev));
344-
WARN_ON(!list_empty(&dev->devres_head));
344+
if (!list_empty(&dev->devres_head)) {
345+
dev_crit(dev, "Resources present before probing\n");
346+
return -EBUSY;
347+
}
345348

346349
re_probe:
347350
dev->driver = drv;

0 commit comments

Comments
 (0)