Skip to content

Commit 689f535

Browse files
Wolfram SangWolfram Sang
authored andcommitted
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 <[email protected]> Reviewed-by: Geert Uytterhoeven <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
1 parent a55aa89 commit 689f535

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/i2c/i2c-core-base.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -832,7 +832,7 @@ EXPORT_SYMBOL_GPL(i2c_new_device);
832832
*/
833833
void i2c_unregister_device(struct i2c_client *client)
834834
{
835-
if (!client)
835+
if (IS_ERR_OR_NULL(client))
836836
return;
837837

838838
if (client->dev.of_node) {

0 commit comments

Comments
 (0)