[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210913131103.380126270@linuxfoundation.org>
Date: Mon, 13 Sep 2021 15:13:14 +0200
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: linux-kernel@...r.kernel.org
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
stable@...r.kernel.org, Hulk Robot <hulkci@...wei.com>,
Zhen Lei <thunder.leizhen@...wei.com>,
Sasha Levin <sashal@...nel.org>
Subject: [PATCH 5.10 089/236] driver core: Fix error return code in really_probe()
From: Zhen Lei <thunder.leizhen@...wei.com>
[ Upstream commit f04948dea236b000da09c466a7ec931ecd8d7867 ]
In the case of error handling, the error code returned by the subfunction
should be propagated instead of 0.
Fixes: 1901fb2604fb ("Driver core: fix "driver" symlink timing")
Fixes: 23b6904442d0 ("driver core: add dev_groups to all drivers")
Fixes: 8fd456ec0cf0 ("driver core: Add state_synced sysfs file for devices that support it")
Reported-by: Hulk Robot <hulkci@...wei.com>
Signed-off-by: Zhen Lei <thunder.leizhen@...wei.com>
Link: https://lore.kernel.org/r/20210707074301.2722-1-thunder.leizhen@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Signed-off-by: Sasha Levin <sashal@...nel.org>
---
drivers/base/dd.c | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/drivers/base/dd.c b/drivers/base/dd.c
index 85bb8742f090..81ad4f867f02 100644
--- a/drivers/base/dd.c
+++ b/drivers/base/dd.c
@@ -543,7 +543,8 @@ re_probe:
goto probe_failed;
}
- if (driver_sysfs_add(dev)) {
+ ret = driver_sysfs_add(dev);
+ if (ret) {
pr_err("%s: driver_sysfs_add(%s) failed\n",
__func__, dev_name(dev));
goto probe_failed;
@@ -565,15 +566,18 @@ re_probe:
goto probe_failed;
}
- if (device_add_groups(dev, drv->dev_groups)) {
+ ret = device_add_groups(dev, drv->dev_groups);
+ if (ret) {
dev_err(dev, "device_add_groups() failed\n");
goto dev_groups_failed;
}
- if (dev_has_sync_state(dev) &&
- device_create_file(dev, &dev_attr_state_synced)) {
- dev_err(dev, "state_synced sysfs add failed\n");
- goto dev_sysfs_state_synced_failed;
+ if (dev_has_sync_state(dev)) {
+ ret = device_create_file(dev, &dev_attr_state_synced);
+ if (ret) {
+ dev_err(dev, "state_synced sysfs add failed\n");
+ goto dev_sysfs_state_synced_failed;
+ }
}
if (test_remove) {
--
2.30.2
Powered by blists - more mailing lists