Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3bacb36d authored by Akinobu Mita's avatar Akinobu Mita Committed by Jean Delvare
Browse files

i2c: Fix return value check in i2c-dev



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: default avatarAkinobu Mita <akinobu.mita@gmail.com>
Cc: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: default avatarJean Delvare <khali@linux-fr.org>
parent 250d1bd3
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -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);