diff options
author | Lu Baolu <baolu.lu@linux.intel.com> | 2021-12-31 11:39:00 +0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2022-01-06 15:47:41 +0100 |
commit | 885e50253bfd6750327a265405461496d6af1639 (patch) | |
tree | 39077d6c96bab42fb0c47b939d71c05b30660872 /drivers/base | |
parent | 3407d826c18d9aed3c51545cc26ff9a2fda65463 (diff) | |
download | linux-stable-885e50253bfd6750327a265405461496d6af1639.tar.gz linux-stable-885e50253bfd6750327a265405461496d6af1639.tar.bz2 linux-stable-885e50253bfd6750327a265405461496d6af1639.zip |
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 <baolu.lu@linux.intel.com>
Link: https://lore.kernel.org/r/20211231033901.2168664-2-baolu.lu@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/base')
-rw-r--r-- | drivers/base/dd.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/base/dd.c b/drivers/base/dd.c index 68ea1f949daa..f6fac016b811 100644 --- a/drivers/base/dd.c +++ b/drivers/base/dd.c @@ -577,14 +577,14 @@ re_probe: if (dev->bus->dma_configure) { ret = dev->bus->dma_configure(dev); if (ret) - goto probe_failed; + goto sysfs_failed; } ret = driver_sysfs_add(dev); if (ret) { pr_err("%s: driver_sysfs_add(%s) failed\n", __func__, dev_name(dev)); - goto probe_failed; + goto sysfs_failed; } if (dev->pm_domain && dev->pm_domain->activate) { @@ -657,6 +657,8 @@ dev_groups_failed: else if (drv->remove) drv->remove(dev); probe_failed: + driver_sysfs_remove(dev); +sysfs_failed: if (dev->bus) blocking_notifier_call_chain(&dev->bus->p->bus_notifier, BUS_NOTIFY_DRIVER_NOT_BOUND, dev); @@ -666,7 +668,6 @@ pinctrl_bind_failed: arch_teardown_dma_ops(dev); kfree(dev->dma_range_map); dev->dma_range_map = NULL; - driver_sysfs_remove(dev); dev->driver = NULL; dev_set_drvdata(dev, NULL); if (dev->pm_domain && dev->pm_domain->dismiss) |