mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH master] i2c: omap: fix probe on am335x
@ 2025-12-12 15:36 Ahmad Fatoum
  2025-12-15  7:41 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Ahmad Fatoum @ 2025-12-12 15:36 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

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 <a.fatoum@pengutronix.de>
---
I manually verified all drivers calling device_get_match_data() and I
believe this to be the only such bug.
---
 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




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH master] i2c: omap: fix probe on am335x
  2025-12-12 15:36 [PATCH master] i2c: omap: fix probe on am335x Ahmad Fatoum
@ 2025-12-15  7:41 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2025-12-15  7:41 UTC (permalink / raw)
  To: barebox, Ahmad Fatoum


On Fri, 12 Dec 2025 16:36:20 +0100, Ahmad Fatoum wrote:
> 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.
> 
> [...]

Applied, thanks!

[1/1] i2c: omap: fix probe on am335x
      https://git.pengutronix.de/cgit/barebox/commit/?id=b3c4f9a12b8c (link may not be stable)

Best regards,
-- 
Sascha Hauer <s.hauer@pengutronix.de>




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-12-15  7:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-12-12 15:36 [PATCH master] i2c: omap: fix probe on am335x Ahmad Fatoum
2025-12-15  7:41 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox