mirror of
https://github.com/torvalds/linux.git
synced 2024-11-23 12:42:02 +00:00
i2c: slave: improve sanity check when registering
Add check for ERR_PTR and simplify code while here. 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
d076947912
commit
1b1be3bf27
@ -18,10 +18,8 @@ int i2c_slave_register(struct i2c_client *client, i2c_slave_cb_t slave_cb)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if (!client || !slave_cb) {
|
||||
WARN(1, "insufficient data\n");
|
||||
if (WARN(IS_ERR_OR_NULL(client) || !slave_cb, "insufficient data\n"))
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (!(client->flags & I2C_CLIENT_SLAVE))
|
||||
dev_warn(&client->dev, "%s: client slave flag not set. You might see address collisions\n",
|
||||
|
Loading…
Reference in New Issue
Block a user