Commit 1b1be3bf authored by Wolfram Sang's avatar Wolfram Sang Committed by Wolfram Sang

i2c: slave: improve sanity check when registering

Add check for ERR_PTR and simplify code while here.
Signed-off-by: default avatarWolfram Sang <wsa+renesas@sang-engineering.com>
Reviewed-by: default avatarAlain Volmat <alain.volmat@st.com>
Signed-off-by: default avatarWolfram Sang <wsa@kernel.org>
parent d0769479
......@@ -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",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment