aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/i2c/i2c-dev.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/i2c/i2c-dev.c b/drivers/i2c/i2c-dev.c
index 567fb05aeccc..3f869033ed70 100644
--- a/drivers/i2c/i2c-dev.c
+++ b/drivers/i2c/i2c-dev.c
@@ -412,9 +412,6 @@ static int i2cdev_attach_adapter(struct i2c_adapter *adap)
412 if (IS_ERR(i2c_dev)) 412 if (IS_ERR(i2c_dev))
413 return PTR_ERR(i2c_dev); 413 return PTR_ERR(i2c_dev);
414 414
415 pr_debug("i2c-dev: adapter [%s] registered as minor %d\n",
416 adap->name, adap->nr);
417
418 /* register this i2c device with the driver core */ 415 /* register this i2c device with the driver core */
419 i2c_dev->class_dev = class_device_create(i2c_dev_class, NULL, 416 i2c_dev->class_dev = class_device_create(i2c_dev_class, NULL,
420 MKDEV(I2C_MAJOR, adap->nr), 417 MKDEV(I2C_MAJOR, adap->nr),
@@ -427,6 +424,9 @@ static int i2cdev_attach_adapter(struct i2c_adapter *adap)
427 res = class_device_create_file(i2c_dev->class_dev, &class_device_attr_name); 424 res = class_device_create_file(i2c_dev->class_dev, &class_device_attr_name);
428 if (res) 425 if (res)
429 goto error_destroy; 426 goto error_destroy;
427
428 pr_debug("i2c-dev: adapter [%s] registered as minor %d\n",
429 adap->name, adap->nr);
430 return 0; 430 return 0;
431error_destroy: 431error_destroy:
432 class_device_destroy(i2c_dev_class, MKDEV(I2C_MAJOR, adap->nr)); 432 class_device_destroy(i2c_dev_class, MKDEV(I2C_MAJOR, adap->nr));
@@ -441,8 +441,8 @@ static int i2cdev_detach_adapter(struct i2c_adapter *adap)
441 struct i2c_dev *i2c_dev; 441 struct i2c_dev *i2c_dev;
442 442
443 i2c_dev = i2c_dev_get_by_minor(adap->nr); 443 i2c_dev = i2c_dev_get_by_minor(adap->nr);
444 if (!i2c_dev) 444 if (!i2c_dev) /* attach_adapter must have failed */
445 return -ENODEV; 445 return 0;
446 446
447 class_device_remove_file(i2c_dev->class_dev, &class_device_attr_name); 447 class_device_remove_file(i2c_dev->class_dev, &class_device_attr_name);
448 return_i2c_dev(i2c_dev); 448 return_i2c_dev(i2c_dev);