diff options
author | Wolfram Sang <wsa+renesas@sang-engineering.com> | 2020-07-25 21:50:53 +0200 |
---|---|---|
committer | Wolfram Sang <wsa@kernel.org> | 2020-07-28 18:37:17 +0200 |
commit | 8808981baf96e1b3dea1f08461e4d958aa0dbde1 (patch) | |
tree | e4837ed95a192f04ae2c5e46e2508f33cadd9abe /drivers/i2c | |
parent | 1b1be3bf27b62f5abcf85c6f3214bdb9c7526685 (diff) | |
download | linux-8808981baf96e1b3dea1f08461e4d958aa0dbde1.tar.bz2 |
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>
Diffstat (limited to 'drivers/i2c')
-rw-r--r-- | drivers/i2c/i2c-core-slave.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/i2c/i2c-core-slave.c b/drivers/i2c/i2c-core-slave.c index 549751347e6c..1589179d5eb9 100644 --- a/drivers/i2c/i2c-core-slave.c +++ b/drivers/i2c/i2c-core-slave.c @@ -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; |