Commit e247fc1b authored by Wolfram Sang's avatar Wolfram Sang Committed by Greg Kroah-Hartman

i2c: slave: add sanity check when unregistering

[ Upstream commit 8808981b ]
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>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent c79c21c7
...@@ -62,6 +62,9 @@ int i2c_slave_unregister(struct i2c_client *client) ...@@ -62,6 +62,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