mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-12 13:55:32 +00:00
i2c: slave: add sanity check when unregistering
[ Upstream commit 8808981baf
]
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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
fb49251695
commit
59822dace1
1 changed files with 3 additions and 0 deletions
|
@ -62,6 +62,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;
|
||||
|
|
Loading…
Reference in a new issue