public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] i2c: Fix return value check
@ 2006-10-17  6:24 Akinobu Mita
  2006-10-18 14:54 ` Jean Delvare
  0 siblings, 1 reply; 4+ messages in thread
From: Akinobu Mita @ 2006-10-17  6:24 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, Jean Delvare

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);

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2006-10-19 10:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-10-17  6:24 [PATCH] i2c: Fix return value check Akinobu Mita
2006-10-18 14:54 ` Jean Delvare
2006-10-19  3:28   ` Akinobu Mita
2006-10-19 10:11     ` Jean Delvare

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox