From: Jeff Liu <jeff.liu@oracle.com>
To: gregkh@linuxfoundation.org
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH 10/24] drivers/base: return actual error on sysfs init
Date: Tue, 17 Jun 2014 22:36:39 +0800 [thread overview]
Message-ID: <53A05277.7060900@oracle.com> (raw)
From: Jie Liu <jeff.liu@oracle.com>
This patch fix all sysfs init functions under drivers core to
return the actual error code than the hardcoded ENOMEM.
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Jie Liu <jeff.liu@oracle.com>
---
drivers/base/bus.c | 16 ++++++++--------
drivers/base/class.c | 4 ++--
drivers/base/core.c | 4 ++--
3 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/drivers/base/bus.c b/drivers/base/bus.c
index 83e910a..b0590a7 100644
--- a/drivers/base/bus.c
+++ b/drivers/base/bus.c
@@ -901,15 +901,15 @@ int bus_register(struct bus_type *bus)
priv->devices_kset = kset_create_and_add("devices", NULL,
&priv->subsys.kobj);
- if (!priv->devices_kset) {
- retval = -ENOMEM;
+ if (IS_ERR(priv->devices_kset)) {
+ retval = PTR_ERR(priv->devices_kset);
goto bus_devices_fail;
}
priv->drivers_kset = kset_create_and_add("drivers", NULL,
&priv->subsys.kobj);
- if (!priv->drivers_kset) {
- retval = -ENOMEM;
+ if (IS_ERR(priv->drivers_kset)) {
+ retval = PTR_ERR(priv->drivers_kset);
goto bus_drivers_fail;
}
@@ -1261,12 +1261,12 @@ EXPORT_SYMBOL_GPL(subsys_virtual_register);
int __init buses_init(void)
{
bus_kset = kset_create_and_add("bus", &bus_uevent_ops, NULL);
- if (!bus_kset)
- return -ENOMEM;
+ if (IS_ERR(bus_kset))
+ return PTR_ERR(bus_kset);
system_kset = kset_create_and_add("system", NULL, &devices_kset->kobj);
- if (!system_kset)
- return -ENOMEM;
+ if (IS_ERR(system_kset))
+ return PTR_ERR(system_kset);
return 0;
}
diff --git a/drivers/base/class.c b/drivers/base/class.c
index f96f704..56e16fa 100644
--- a/drivers/base/class.c
+++ b/drivers/base/class.c
@@ -584,8 +584,8 @@ EXPORT_SYMBOL_GPL(class_compat_remove_link);
int __init classes_init(void)
{
class_kset = kset_create_and_add("class", NULL, NULL);
- if (!class_kset)
- return -ENOMEM;
+ if (IS_ERR(class_kset))
+ return PTR_ERR(class_kset);
return 0;
}
diff --git a/drivers/base/core.c b/drivers/base/core.c
index 20da3ad..0f729f9 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -1364,8 +1364,8 @@ EXPORT_SYMBOL_GPL(device_find_child);
int __init devices_init(void)
{
devices_kset = kset_create_and_add("devices", &device_uevent_ops, NULL);
- if (!devices_kset)
- return -ENOMEM;
+ if (IS_ERR(devices_kset))
+ return PTR_ERR(devices_kset);
dev_kobj = kobject_create_and_add("dev", NULL);
if (!dev_kobj)
goto dev_kobj_err;
--
1.8.3.2
next reply other threads:[~2014-06-17 14:36 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-17 14:36 Jeff Liu [this message]
2014-06-17 19:22 ` Greg KH
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=53A05277.7060900@oracle.com \
--to=jeff.liu@oracle.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome