From: Sven Wegener Date: Wed, 24 Sep 2008 11:39:21 +0000 (+0200) Subject: i2c-dev: Return correct error code on class_create() failure X-Git-Tag: v2.6.27-rc8~20^2~1 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=e74783ec3cb981211689bd2cfd3248f8dc48ec01;p=linux-2.6-omap-h63xx.git i2c-dev: Return correct error code on class_create() failure We need to convert the error pointer from class_create(), else we'll return the successful return code from register_chrdev() on failure. Signed-off-by: Sven Wegener Signed-off-by: Jean Delvare --- diff --git a/drivers/i2c/i2c-dev.c b/drivers/i2c/i2c-dev.c index af4491fa7e3..307d976c9b6 100644 --- a/drivers/i2c/i2c-dev.c +++ b/drivers/i2c/i2c-dev.c @@ -583,8 +583,10 @@ static int __init i2c_dev_init(void) goto out; i2c_dev_class = class_create(THIS_MODULE, "i2c-dev"); - if (IS_ERR(i2c_dev_class)) + if (IS_ERR(i2c_dev_class)) { + res = PTR_ERR(i2c_dev_class); goto out_unreg_chrdev; + } res = i2c_add_driver(&i2cdev_driver); if (res)