The AM335x uses ti,omap4-i2c as compatible for the I2C device tree
nodes, but that compatible unlike its brethern has no driver data as
it's determined using the machine compatible in the probe function
instead.

device_get_match_data() returning NULL is thus expected and should not
lead to an immediate error.

Fixes: 20d87123a638 ("treewide: replace dev_get_drvdata with 
device_get_match_data")
Signed-off-by: Ahmad Fatoum <[email protected]>
Link: https://lore.barebox.org/[email protected]
Signed-off-by: Sascha Hauer <[email protected]>
(cherry picked from commit b3c4f9a12b8c127f0ae48a5eab082090a60dfdf2)
Signed-off-by: Ahmad Fatoum <[email protected]>
---
 drivers/i2c/busses/i2c-omap.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index 29378a96d722..c45483579250 100644
--- a/drivers/i2c/busses/i2c-omap.c
+++ b/drivers/i2c/busses/i2c-omap.c
@@ -1076,14 +1076,15 @@ i2c_omap_probe(struct device *pdev)
        }
 
        i2c_data = device_get_match_data(pdev);
-       if (!i2c_data)
-               return -ENODEV;
 
        if (of_machine_is_compatible("ti,am33xx"))
                i2c_data = &am33xx_data;
        if (of_machine_is_compatible("ti,omap4"))
                i2c_data = &omap4_data;
 
+       if (!i2c_data)
+               return -EINVAL;
+
        i2c_omap->data = i2c_data;
        i2c_omap->reg_shift = (i2c_data->flags >>
                                        OMAP_I2C_FLAG_BUS_SHIFT__SHIFT) & 3;
-- 
2.47.3


Reply via email to