diff options
Diffstat (limited to 'drivers/i2c/i2c-core.c')
-rw-r--r-- | drivers/i2c/i2c-core.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c index 5ab67219f71e..1704fc84d647 100644 --- a/drivers/i2c/i2c-core.c +++ b/drivers/i2c/i2c-core.c | |||
@@ -1681,6 +1681,7 @@ static struct i2c_client *of_i2c_register_device(struct i2c_adapter *adap, | |||
1681 | static void of_i2c_register_devices(struct i2c_adapter *adap) | 1681 | static void of_i2c_register_devices(struct i2c_adapter *adap) |
1682 | { | 1682 | { |
1683 | struct device_node *bus, *node; | 1683 | struct device_node *bus, *node; |
1684 | struct i2c_client *client; | ||
1684 | 1685 | ||
1685 | /* Only register child devices if the adapter has a node pointer set */ | 1686 | /* Only register child devices if the adapter has a node pointer set */ |
1686 | if (!adap->dev.of_node) | 1687 | if (!adap->dev.of_node) |
@@ -1695,7 +1696,14 @@ static void of_i2c_register_devices(struct i2c_adapter *adap) | |||
1695 | for_each_available_child_of_node(bus, node) { | 1696 | for_each_available_child_of_node(bus, node) { |
1696 | if (of_node_test_and_set_flag(node, OF_POPULATED)) | 1697 | if (of_node_test_and_set_flag(node, OF_POPULATED)) |
1697 | continue; | 1698 | continue; |
1698 | of_i2c_register_device(adap, node); | 1699 | |
1700 | client = of_i2c_register_device(adap, node); | ||
1701 | if (IS_ERR(client)) { | ||
1702 | dev_warn(&adap->dev, | ||
1703 | "Failed to create I2C device for %s\n", | ||
1704 | node->full_name); | ||
1705 | of_node_clear_flag(node, OF_POPULATED); | ||
1706 | } | ||
1699 | } | 1707 | } |
1700 | 1708 | ||
1701 | of_node_put(bus); | 1709 | of_node_put(bus); |
@@ -2299,6 +2307,7 @@ static int of_i2c_notify(struct notifier_block *nb, unsigned long action, | |||
2299 | if (IS_ERR(client)) { | 2307 | if (IS_ERR(client)) { |
2300 | dev_err(&adap->dev, "failed to create client for '%s'\n", | 2308 | dev_err(&adap->dev, "failed to create client for '%s'\n", |
2301 | rd->dn->full_name); | 2309 | rd->dn->full_name); |
2310 | of_node_clear_flag(rd->dn, OF_POPULATED); | ||
2302 | return notifier_from_errno(PTR_ERR(client)); | 2311 | return notifier_from_errno(PTR_ERR(client)); |
2303 | } | 2312 | } |
2304 | break; | 2313 | break; |