Skip to content

Commit 885e502

Browse files
LuBaolugregkh
authored andcommitted
driver core: Move driver_sysfs_remove() after driver_sysfs_add()
The driver_sysfs_remove() should be called after driver_sysfs_add() in really_probe(). The out-of-order driver_sysfs_remove() tries to remove some nonexistent nodes under the device and driver sysfs nodes. This is allowed, hence this change doesn't fix any problem, just a cleanup. Signed-off-by: Lu Baolu <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 3407d82 commit 885e502

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

drivers/base/dd.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -577,14 +577,14 @@ static int really_probe(struct device *dev, struct device_driver *drv)
577577
if (dev->bus->dma_configure) {
578578
ret = dev->bus->dma_configure(dev);
579579
if (ret)
580-
goto probe_failed;
580+
goto sysfs_failed;
581581
}
582582

583583
ret = driver_sysfs_add(dev);
584584
if (ret) {
585585
pr_err("%s: driver_sysfs_add(%s) failed\n",
586586
__func__, dev_name(dev));
587-
goto probe_failed;
587+
goto sysfs_failed;
588588
}
589589

590590
if (dev->pm_domain && dev->pm_domain->activate) {
@@ -657,6 +657,8 @@ static int really_probe(struct device *dev, struct device_driver *drv)
657657
else if (drv->remove)
658658
drv->remove(dev);
659659
probe_failed:
660+
driver_sysfs_remove(dev);
661+
sysfs_failed:
660662
if (dev->bus)
661663
blocking_notifier_call_chain(&dev->bus->p->bus_notifier,
662664
BUS_NOTIFY_DRIVER_NOT_BOUND, dev);
@@ -666,7 +668,6 @@ static int really_probe(struct device *dev, struct device_driver *drv)
666668
arch_teardown_dma_ops(dev);
667669
kfree(dev->dma_range_map);
668670
dev->dma_range_map = NULL;
669-
driver_sysfs_remove(dev);
670671
dev->driver = NULL;
671672
dev_set_drvdata(dev, NULL);
672673
if (dev->pm_domain && dev->pm_domain->dismiss)

0 commit comments

Comments
 (0)