]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
i2c: make i2c_unregister_device() ERR_PTR safe
authorWolfram Sang <wsa+renesas@sang-engineering.com>
Mon, 19 Aug 2019 20:48:25 +0000 (22:48 +0200)
committerWolfram Sang <wsa@the-dreams.de>
Thu, 29 Aug 2019 18:38:11 +0000 (20:38 +0200)
We are moving towards returning ERR_PTRs when i2c_new_*_device() calls
fail. Make sure its counterpart for unregistering handles ERR_PTRs as
well.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
drivers/i2c/i2c-core-base.c

index f26ed495d38420b3864c997945940941dcf5e754..9c440fa6a3dd109349a86365a678e46ffe8b89f7 100644 (file)
@@ -832,7 +832,7 @@ EXPORT_SYMBOL_GPL(i2c_new_device);
  */
 void i2c_unregister_device(struct i2c_client *client)
 {
-       if (!client)
+       if (IS_ERR_OR_NULL(client))
                return;
 
        if (client->dev.of_node) {