From: Akinobu Mita <akinobu.mita@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@suse.de>, Jean Delvare <khali@linux-fr.org>
Subject: [PATCH] i2c: Fix return value check
Date: Tue, 17 Oct 2006 15:24:49 +0900 [thread overview]
Message-ID: <20061017062449.GA13100@localhost> (raw)
class_device_create() returns error code as pointer on failure.
This patch checks the return value of class_device_create() by using IS_ERR().
Cc: Greg Kroah-Hartman <gregkh@suse.de>
Cc: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Akinbou Mita <akinobu.mita@gmail.com>
drivers/i2c/i2c-dev.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
Index: 2.6-rc/drivers/i2c/i2c-dev.c
===================================================================
--- 2.6-rc.orig/drivers/i2c/i2c-dev.c
+++ 2.6-rc/drivers/i2c/i2c-dev.c
@@ -417,8 +417,8 @@ static int i2cdev_attach_adapter(struct
MKDEV(I2C_MAJOR, adap->nr),
&adap->dev, "i2c-%d",
adap->nr);
- if (!i2c_dev->class_dev) {
- res = -ENODEV;
+ if (IS_ERR(i2c_dev->class_dev)) {
+ res = PTR_ERR(i2c_dev->class_dev);
goto error;
}
res = class_device_create_file(i2c_dev->class_dev, &class_device_attr_name);
next reply other threads:[~2006-10-17 6:24 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-10-17 6:24 Akinobu Mita [this message]
2006-10-18 14:54 ` [PATCH] i2c: Fix return value check Jean Delvare
2006-10-19 3:28 ` Akinobu Mita
2006-10-19 10:11 ` Jean Delvare
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=20061017062449.GA13100@localhost \
--to=akinobu.mita@gmail.com \
--cc=gregkh@suse.de \
--cc=khali@linux-fr.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