Commit 8808981b authored by Wolfram Sang's avatar Wolfram Sang Committed by Wolfram Sang

i2c: slave: add sanity check when unregistering

Signed-off-by: default avatarWolfram Sang <wsa+renesas@sang-engineering.com>
Reviewed-by: default avatarAlain Volmat <alain.volmat@st.com>
Signed-off-by: default avatarWolfram Sang <wsa@kernel.org>
parent 1b1be3bf
...@@ -58,6 +58,9 @@ int i2c_slave_unregister(struct i2c_client *client) ...@@ -58,6 +58,9 @@ int i2c_slave_unregister(struct i2c_client *client)
{ {
int ret; int ret;
if (IS_ERR_OR_NULL(client))
return -EINVAL;
if (!client->adapter->algo->unreg_slave) { if (!client->adapter->algo->unreg_slave) {
dev_err(&client->dev, "%s: not supported by adapter\n", __func__); dev_err(&client->dev, "%s: not supported by adapter\n", __func__);
return -EOPNOTSUPP; return -EOPNOTSUPP;
......
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