public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jeff Liu <jeff.liu@oracle.com>
To: stefanr@s5r6.in-berlin.de
Cc: linux1394-devel@lists.sourceforge.net,
	LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH 08/24] drivers/firmware: return actual error on sysfs init
Date: Tue, 17 Jun 2014 22:29:14 +0800	[thread overview]
Message-ID: <53A050BA.9010004@oracle.com> (raw)

From: Jie Liu <jeff.liu@oracle.com>

This patch fix all sysfs init functions under firmware subsystems
to return the actual error if call kset_create_and_add() failed.

Cc: Stefan Richter <stefanr@s5r6.in-berlin.de>
Signed-off-by: Jie Liu <jeff.liu@oracle.com>
---
 drivers/firmware/dmi-sysfs.c       | 4 +++-
 drivers/firmware/edd.c             | 4 ++--
 drivers/firmware/efi/efivars.c     | 4 ++--
 drivers/firmware/efi/runtime-map.c | 4 ++--
 drivers/firmware/memmap.c          | 4 ++--
 5 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/drivers/firmware/dmi-sysfs.c b/drivers/firmware/dmi-sysfs.c
index e0f1cb3..9e867f4 100644
--- a/drivers/firmware/dmi-sysfs.c
+++ b/drivers/firmware/dmi-sysfs.c
@@ -657,8 +657,10 @@ static int __init dmi_sysfs_init(void)
 		goto err;
 
 	dmi_kset = kset_create_and_add("entries", NULL, dmi_kobj);
-	if (!dmi_kset)
+	if (IS_ERR(dmi_kset)) {
+		error = PTR_ERR(dmi_kset);
 		goto err;
+	}
 
 	val = 0;
 	error = dmi_walk(dmi_sysfs_register_handle, &val);
diff --git a/drivers/firmware/edd.c b/drivers/firmware/edd.c
index e229576..c3bc8f1 100644
--- a/drivers/firmware/edd.c
+++ b/drivers/firmware/edd.c
@@ -757,8 +757,8 @@ edd_init(void)
 	}
 
 	edd_kset = kset_create_and_add("edd", NULL, firmware_kobj);
-	if (!edd_kset)
-		return -ENOMEM;
+	if (IS_ERR(edd_kset))
+		return PTR_ERR(edd_kset);
 
 	for (i = 0; i < edd_num_devices(); i++) {
 		edev = kzalloc(sizeof (*edev), GFP_KERNEL);
diff --git a/drivers/firmware/efi/efivars.c b/drivers/firmware/efi/efivars.c
index 463c565..057568f 100644
--- a/drivers/firmware/efi/efivars.c
+++ b/drivers/firmware/efi/efivars.c
@@ -730,9 +730,9 @@ int efivars_sysfs_init(void)
 	       EFIVARS_DATE);
 
 	efivars_kset = kset_create_and_add("vars", NULL, parent_kobj);
-	if (!efivars_kset) {
+	if (IS_ERR(efivars_kset)) {
 		printk(KERN_ERR "efivars: Subsystem registration failed.\n");
-		return -ENOMEM;
+		return PTR_ERR(efivars_kset);
 	}
 
 	efivar_init(efivars_sysfs_callback, NULL, false,
diff --git a/drivers/firmware/efi/runtime-map.c b/drivers/firmware/efi/runtime-map.c
index 97cdd16..df881b1 100644
--- a/drivers/firmware/efi/runtime-map.c
+++ b/drivers/firmware/efi/runtime-map.c
@@ -113,8 +113,8 @@ add_sysfs_runtime_map_entry(struct kobject *kobj, int nr)
 
 	if (!map_kset) {
 		map_kset = kset_create_and_add("runtime-map", NULL, kobj);
-		if (!map_kset)
-			return ERR_PTR(-ENOMEM);
+		if (IS_ERR(map_kset))
+			return ERR_CAST(map_kset);
 	}
 
 	entry = kzalloc(sizeof(*entry), GFP_KERNEL);
diff --git a/drivers/firmware/memmap.c b/drivers/firmware/memmap.c
index 17cf96c..23e40c9 100644
--- a/drivers/firmware/memmap.c
+++ b/drivers/firmware/memmap.c
@@ -186,8 +186,8 @@ static int add_sysfs_fw_map_entry(struct firmware_map_entry *entry)
 
 	if (!mmap_kset) {
 		mmap_kset = kset_create_and_add("memmap", NULL, firmware_kobj);
-		if (!mmap_kset)
-			return -ENOMEM;
+		if (IS_ERR(mmap_kset))
+			return PTR_ERR(mmap_kset);
 	}
 
 	entry->kobj.kset = mmap_kset;
-- 
1.8.3.2

             reply	other threads:[~2014-06-17 14:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-17 14:29 Jeff Liu [this message]
2014-06-17 19:25 ` [PATCH 08/24] drivers/firmware: return actual error on sysfs init 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=53A050BA.9010004@oracle.com \
    --to=jeff.liu@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux1394-devel@lists.sourceforge.net \
    --cc=stefanr@s5r6.in-berlin.de \
    /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