mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH master] i2c: omap: fix probe on am335x
Date: Fri, 12 Dec 2025 16:36:20 +0100	[thread overview]
Message-ID: <20251212153649.365215-1-a.fatoum@pengutronix.de> (raw)

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




             reply	other threads:[~2025-12-12 15:37 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-12 15:36 Ahmad Fatoum [this message]
2025-12-15  7:41 ` Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251212153649.365215-1-a.fatoum@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox