Skip to content

Commit 7dc6fd0

Browse files
committed
Merge branch 'i2c/for-current' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux
Pull i2c fixes from Wolfram Sang: "Some I2C core improvements to prevent NULL pointer usage and a MAINTAINERS update" * 'i2c/for-current' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux: i2c: slave: add sanity check when unregistering i2c: slave: improve sanity check when registering MAINTAINERS: Update GENI I2C maintainers list i2c: also convert placeholder function to return errno
2 parents deacdb3 + 8808981 commit 7dc6fd0

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

MAINTAINERS

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14188,7 +14188,8 @@ F: Documentation/devicetree/bindings/net/qcom,ethqos.txt
1418814188
F: drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
1418914189

1419014190
QUALCOMM GENERIC INTERFACE I2C DRIVER
14191-
M: Alok Chauhan <[email protected]>
14191+
M: Akash Asthana <[email protected]>
14192+
M: Mukesh Savaliya <[email protected]>
1419214193
1419314194
1419414195
S: Supported

drivers/i2c/i2c-core-slave.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,8 @@ int i2c_slave_register(struct i2c_client *client, i2c_slave_cb_t slave_cb)
1818
{
1919
int ret;
2020

21-
if (!client || !slave_cb) {
22-
WARN(1, "insufficient data\n");
21+
if (WARN(IS_ERR_OR_NULL(client) || !slave_cb, "insufficient data\n"))
2322
return -EINVAL;
24-
}
2523

2624
if (!(client->flags & I2C_CLIENT_SLAVE))
2725
dev_warn(&client->dev, "%s: client slave flag not set. You might see address collisions\n",
@@ -60,6 +58,9 @@ int i2c_slave_unregister(struct i2c_client *client)
6058
{
6159
int ret;
6260

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

include/linux/i2c.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1001,7 +1001,7 @@ static inline u32 i2c_acpi_find_bus_speed(struct device *dev)
10011001
static inline struct i2c_client *i2c_acpi_new_device(struct device *dev,
10021002
int index, struct i2c_board_info *info)
10031003
{
1004-
return NULL;
1004+
return ERR_PTR(-ENODEV);
10051005
}
10061006
static inline struct i2c_adapter *i2c_acpi_find_adapter_by_handle(acpi_handle handle)
10071007
{

0 commit comments

Comments
 (0)