From: Wolfram Sang Date: Mon, 19 Aug 2019 20:48:25 +0000 (+0200) Subject: i2c: make i2c_unregister_device() ERR_PTR safe X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=689f535843ac2633b395cfc494446326d03efab6;p=linux.git i2c: make i2c_unregister_device() ERR_PTR safe 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 Reviewed-by: Geert Uytterhoeven Signed-off-by: Wolfram Sang --- diff --git a/drivers/i2c/i2c-core-base.c b/drivers/i2c/i2c-core-base.c index f26ed495d3842..9c440fa6a3dd1 100644 --- a/drivers/i2c/i2c-core-base.c +++ b/drivers/i2c/i2c-core-base.c @@ -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) {