diff options
author | Sven Wegener <sven.wegener@stealer.net> | 2008-09-24 07:39:21 -0400 |
---|---|---|
committer | Jean Delvare <khali@mahadeva.delvare> | 2008-09-24 07:39:21 -0400 |
commit | e74783ec3cb981211689bd2cfd3248f8dc48ec01 (patch) | |
tree | 0835a0ade974c7a77ef6534038a85537ca5f6c2a | |
parent | 4ebb52d34fac2904e541ccfa8e32126db836fa92 (diff) |
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 <sven.wegener@stealer.net>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
-rw-r--r-- | drivers/i2c/i2c-dev.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/i2c/i2c-dev.c b/drivers/i2c/i2c-dev.c index af4491fa7e34..307d976c9b69 100644 --- a/drivers/i2c/i2c-dev.c +++ b/drivers/i2c/i2c-dev.c | |||
@@ -583,8 +583,10 @@ static int __init i2c_dev_init(void) | |||
583 | goto out; | 583 | goto out; |
584 | 584 | ||
585 | i2c_dev_class = class_create(THIS_MODULE, "i2c-dev"); | 585 | i2c_dev_class = class_create(THIS_MODULE, "i2c-dev"); |
586 | if (IS_ERR(i2c_dev_class)) | 586 | if (IS_ERR(i2c_dev_class)) { |
587 | res = PTR_ERR(i2c_dev_class); | ||
587 | goto out_unreg_chrdev; | 588 | goto out_unreg_chrdev; |
589 | } | ||
588 | 590 | ||
589 | res = i2c_add_driver(&i2cdev_driver); | 591 | res = i2c_add_driver(&i2cdev_driver); |
590 | if (res) | 592 | if (res) |