[PATCH] of/i2c: call i2c_verify_client from of_find_i2c_device_by_node

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Stephen Warren <swarren@xxxxxxxxxx>

i2c_bus_type may contain both I2C clients and I2C adapters. Fix
of_find_i2c_device_by_node to call i2c_verify_client to ensure that it
only returns non-NULL of I2C clients.

Signed-off-by: Stephen Warren <swarren@xxxxxxxxxx>
---
Note: This is a dependency for the pinctrl I2C bus mux I will send in a
minute. It'd probably be easiest to merge this through the I2C tree.
It might also be useful to put this patch (and the others I'll send) in
a separate tree so it can be merged into any SoC trees that wish to use
this new feature.

 drivers/of/of_i2c.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/of/of_i2c.c b/drivers/of/of_i2c.c
index f37fbeb..0684887 100644
--- a/drivers/of/of_i2c.c
+++ b/drivers/of/of_i2c.c
@@ -90,7 +90,7 @@ struct i2c_client *of_find_i2c_device_by_node(struct device_node *node)
 	if (!dev)
 		return NULL;
 
-	return to_i2c_client(dev);
+	return i2c_verify_client(dev);
 }
 EXPORT_SYMBOL(of_find_i2c_device_by_node);
 
-- 
1.7.0.4

--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux GPIO]     [Linux SPI]     [Linux Hardward Monitoring]     [LM Sensors]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux