mirror of
https://github.com/torvalds/linux.git
synced 2024-11-23 12:42:02 +00:00
i2c: slave: add sanity check when unregistering
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>
This commit is contained in:
parent
1b1be3bf27
commit
8808981baf
@ -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;
|
||||||
|
Loading…
Reference in New Issue
Block a user