[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240723-bus_fix-v1-1-175f926805dc@quicinc.com>
Date: Tue, 23 Jul 2024 22:55:43 +0800
From: Zijun Hu <zijun_hu@...oud.com>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
"Rafael J. Wysocki" <rafael@...nel.org>
Cc: Zijun Hu <zijun_hu@...oud.com>, linux-kernel@...r.kernel.org,
Zijun Hu <quic_zijuhu@...cinc.com>
Subject: [PATCH] driver core: bus: Return -EIO instead of 0 when show/store
invalid bus attribute
From: Zijun Hu <quic_zijuhu@...cinc.com>
Return -EIO instead of 0 when show/store invalid bus attribute as
class/device/driver/kobject attribute.
Signed-off-by: Zijun Hu <quic_zijuhu@...cinc.com>
---
drivers/base/bus.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/base/bus.c b/drivers/base/bus.c
index ffea0728b8b2..e84522a90102 100644
--- a/drivers/base/bus.c
+++ b/drivers/base/bus.c
@@ -152,7 +152,7 @@ static ssize_t bus_attr_show(struct kobject *kobj, struct attribute *attr,
{
struct bus_attribute *bus_attr = to_bus_attr(attr);
struct subsys_private *subsys_priv = to_subsys_private(kobj);
- ssize_t ret = 0;
+ ssize_t ret = -EIO;
if (bus_attr->show)
ret = bus_attr->show(subsys_priv->bus, buf);
@@ -164,7 +164,7 @@ static ssize_t bus_attr_store(struct kobject *kobj, struct attribute *attr,
{
struct bus_attribute *bus_attr = to_bus_attr(attr);
struct subsys_private *subsys_priv = to_subsys_private(kobj);
- ssize_t ret = 0;
+ ssize_t ret = -EIO;
if (bus_attr->store)
ret = bus_attr->store(subsys_priv->bus, buf, count);
---
base-commit: b57d5ffc3ab507d0e19fc8b90b19c76af43fb790
change-id: 20240723-bus_fix-1940d8e79e92
Best regards,
--
Zijun Hu <quic_zijuhu@...cinc.com>
Powered by blists - more mailing lists