]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
i2c: Fix return value check in i2c-dev
authorAkinobu Mita <akinobu.mita@gmail.com>
Sun, 10 Dec 2006 20:21:33 +0000 (21:21 +0100)
committerJean Delvare <khali@arrakis.delvare>
Sun, 10 Dec 2006 20:21:33 +0000 (21:21 +0100)
device_create() returns error code as pointer on failures.
This patch checks the return value of device_create() by using IS_ERR().

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
drivers/i2c/i2c-dev.c

index cf9381eae8da4d53924e07428f8113a3921b7054..909428af2b7ebf7ab20e876000caf96411c38cf8 100644 (file)
@@ -416,8 +416,8 @@ static int i2cdev_attach_adapter(struct i2c_adapter *adap)
        i2c_dev->dev = device_create(i2c_dev_class, &adap->dev,
                                     MKDEV(I2C_MAJOR, adap->nr),
                                     "i2c-%d", adap->nr);
-       if (!i2c_dev->dev) {
-               res = -ENODEV;
+       if (IS_ERR(i2c_dev->dev)) {
+               res = PTR_ERR(i2c_dev->dev);
                goto error;
        }
        res = device_create_file(i2c_dev->dev, &dev_attr_name);