Commit 689f5358 authored by Wolfram Sang's avatar Wolfram Sang Committed by Wolfram Sang

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: default avatarWolfram Sang <wsa+renesas@sang-engineering.com>
Reviewed-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: default avatarWolfram Sang <wsa@the-dreams.de>
parent a55aa89a
...@@ -832,7 +832,7 @@ EXPORT_SYMBOL_GPL(i2c_new_device); ...@@ -832,7 +832,7 @@ EXPORT_SYMBOL_GPL(i2c_new_device);
*/ */
void i2c_unregister_device(struct i2c_client *client) void i2c_unregister_device(struct i2c_client *client)
{ {
if (!client) if (IS_ERR_OR_NULL(client))
return; return;
if (client->dev.of_node) { if (client->dev.of_node) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment