Skip to content

Commit 8808981

Browse files
Wolfram Sangwsakernel
authored andcommitted
i2c: slave: add sanity check when unregistering
Signed-off-by: Wolfram Sang <[email protected]> Reviewed-by: Alain Volmat <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
1 parent 1b1be3b commit 8808981

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

drivers/i2c/i2c-core-slave.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ int i2c_slave_unregister(struct i2c_client *client)
5858
{
5959
int ret;
6060

61+
if (IS_ERR_OR_NULL(client))
62+
return -EINVAL;
63+
6164
if (!client->adapter->algo->unreg_slave) {
6265
dev_err(&client->dev, "%s: not supported by adapter\n", __func__);
6366
return -EOPNOTSUPP;

0 commit comments

Comments
 (0)