Skip to content

Commit

Permalink
i2c: slave: add sanity check when unregistering
Browse files Browse the repository at this point in the history
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Reviewed-by: Alain Volmat <alain.volmat@st.com>
Signed-off-by: Wolfram Sang <wsa@kernel.org>
  • Loading branch information
Wolfram Sang authored and Wolfram Sang committed Jul 28, 2020
1 parent 1b1be3b commit 8808981
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/i2c/i2c-core-slave.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ int i2c_slave_unregister(struct i2c_client *client)
{
int ret;

if (IS_ERR_OR_NULL(client))
return -EINVAL;

if (!client->adapter->algo->unreg_slave) {
dev_err(&client->dev, "%s: not supported by adapter\n", __func__);
return -EOPNOTSUPP;
Expand Down

0 comments on commit 8808981

Please sign in to comment.