Skip to content

Commit

Permalink
i2c-dev: Return correct error code on class_create() failure
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Sven Wegener authored and Jean Delvare committed Sep 24, 2008
1 parent 4ebb52d commit e74783e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/i2c/i2c-dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit e74783e

Please sign in to comment.