Skip to content

Commit

Permalink
i2c: make i2c_unregister_device() ERR_PTR safe
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Wolfram Sang authored and Wolfram Sang committed Aug 29, 2019
1 parent a55aa89 commit 689f535
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/i2c/i2c-core-base.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 689f535

Please sign in to comment.