Skip to content

Commit 7c35e69

Browse files
geertugregkh
authored andcommitted
driver core: Print device when resources present in really_probe()
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]>
1 parent 264d252 commit 7c35e69

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
@@ -516,7 +516,10 @@ static int really_probe(struct device *dev, struct device_driver *drv)
516516
atomic_inc(&probe_count);
517517
pr_debug("bus: '%s': %s: probing driver %s with device %s\n",
518518
drv->bus->name, __func__, drv->name, dev_name(dev));
519-
WARN_ON(!list_empty(&dev->devres_head));
519+
if (!list_empty(&dev->devres_head)) {
520+
dev_crit(dev, "Resources present before probing\n");
521+
return -EBUSY;
522+
}
520523

521524
re_probe:
522525
dev->driver = drv;

0 commit comments

Comments
 (0)