summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSven Wegener <sven.wegener@stealer.net>2008-09-28 14:14:21 +0200
committerGreg Kroah-Hartman <gregkh@suse.de>2008-10-08 19:44:40 -0700
commitef1e78583cb3b184316f909c7cfe365c2fee2cd2 (patch)
tree9fb7d59f7f1005d5c529d51ee6a78d141880375f
parent24ac281c6c6ae8d1fe9752cb5647e6d140134a6f (diff)
downloadlwn-ef1e78583cb3b184316f909c7cfe365c2fee2cd2.tar.gz
lwn-ef1e78583cb3b184316f909c7cfe365c2fee2cd2.zip
i2c-dev: Return correct error code on class_create() failure
In Linus' tree: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Ftorvalds%2Flinux-2.6.git;a=commit;h=e74783ec3cb981211689bd2cfd3248f8dc48ec01 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 <sven.wegener@stealer.net> Signed-off-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--drivers/i2c/i2c-dev.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/i2c/i2c-dev.c b/drivers/i2c/i2c-dev.c
index 393e679d9faa..342255bf0f91 100644
--- a/drivers/i2c/i2c-dev.c
+++ b/drivers/i2c/i2c-dev.c
@@ -574,8 +574,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)