All of lore.kernel.org
 help / color / mirror / Atom feed
From: Akinobu Mita <akinobu.mita@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: Abhay Salunke <abhay_salunke@dell.com>
Subject: [PATCH] dell_rbu: fix error check
Date: Wed, 15 Nov 2006 06:18:23 +0900	[thread overview]
Message-ID: <20061114211823.GC20524@localhost> (raw)

platform_device_register_simple() returns error code as pointer
when it fails. The return value should be checked by IS_ERR().

Cc: Abhay Salunke <abhay_salunke@dell.com>
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>

 drivers/firmware/dell_rbu.c |    9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

Index: work-fault-inject/drivers/firmware/dell_rbu.c
===================================================================
--- work-fault-inject.orig/drivers/firmware/dell_rbu.c
+++ work-fault-inject/drivers/firmware/dell_rbu.c
@@ -705,17 +705,16 @@ static struct bin_attribute rbu_packet_s
 
 static int __init dcdrbu_init(void)
 {
-	int rc = 0;
+	int rc;
 	spin_lock_init(&rbu_data.lock);
 
 	init_packet_head();
-	rbu_device =
-		platform_device_register_simple("dell_rbu", -1, NULL, 0);
-	if (!rbu_device) {
+	rbu_device = platform_device_register_simple("dell_rbu", -1, NULL, 0);
+	if (IS_ERR(rbu_device)) {
 		printk(KERN_ERR
 			"dell_rbu:%s:platform_device_register_simple "
 			"failed\n", __FUNCTION__);
-		return -EIO;
+		return PTR_ERR(rbu_device);
 	}
 
 	rc = sysfs_create_bin_file(&rbu_device->dev.kobj, &rbu_data_attr);

                 reply	other threads:[~2006-11-14 21:18 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20061114211823.GC20524@localhost \
    --to=akinobu.mita@gmail.com \
    --cc=abhay_salunke@dell.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.