i2c: i2c_del_adapter: Don't treat removing a non-registered adapter as error
authorLars-Peter Clausen <lars@metafoo.de>
Sat, 9 Mar 2013 08:16:45 +0000 (08:16 +0000)
committerWolfram Sang <wsa@the-dreams.de>
Tue, 2 Apr 2013 05:03:37 +0000 (07:03 +0200)
Currently i2c_del_adapter() returns -EINVAL when it gets an adapter which is not
registered. But none of the users of i2c_del_adapter() depend on this behavior,
so for the sake of being able to sanitize the return type of i2c_del_adapter
argue, that the purpose of i2c_del_adapter() is to remove an I2C adapter from
the system. If the adapter is not registered in the first place this becomes a
no-op. So we can return success without having to do anything.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Reviewed-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
drivers/i2c/i2c-core.c

index f7cd05b..e4fe494 100644 (file)
@@ -1231,7 +1231,7 @@ int i2c_del_adapter(struct i2c_adapter *adap)
        if (found != adap) {
                pr_debug("i2c-core: attempting to delete unregistered "
                         "adapter [%s]\n", adap->name);
-               return -EINVAL;
+               return 0;
        }
 
        /* Tell drivers about this removal */