mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-08 03:40:35 +09:00
i2c: slave: improve sanity check when registering
[ Upstream commit 1b1be3bf27 ]
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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
1e64cb7dab
commit
c79c21c791
@@ -22,10 +22,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",
|
||||
|
||||
Reference in New Issue
Block a user