Skip to content

Commit 871b5a5

Browse files
Wolfram Sanggregkh
authored andcommitted
i2c: slave: add sanity check when unregistering
[ Upstream commit 8808981 ] 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>
1 parent fa0195d commit 871b5a5

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

drivers/i2c/i2c-core-slave.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ int i2c_slave_unregister(struct i2c_client *client)
5858
{
5959
int ret;
6060

61+
if (IS_ERR_OR_NULL(client))
62+
return -EINVAL;
63+
6164
if (!client->adapter->algo->unreg_slave) {
6265
dev_err(&client->dev, "%s: not supported by adapter\n", __func__);
6366
return -EOPNOTSUPP;

0 commit comments

Comments
 (0)