mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] media: rtl28xxu: require both TDA18272 ID bytes when probing
@ 2026-12-03 14:12 Bilal Yazıcıoğlu
  0 siblings, 0 replies; only message in thread
From: Bilal Yazıcıoğlu @ 2026-12-03 14:12 UTC (permalink / raw)
  To: linux-media
  Cc: Mauro Carvalho Chehab, Antti Palosaari, linux-kernel,
	Bilal Yazıcıoğlu

The TDA18272 probe in rtl2832u_read_config() reads two bytes from I2C
address 0xc0, and the comment says the expected ID is 0xc760. The
check, however, accepts the tuner if either byte matches:

	if (ret == 0 && (buf[0] == 0xc7 || buf[1] == 0x60))

Tuners are probed in order and the first match ends the probe. The
TDA18272 check comes before the R820T, R828D and Si2157 checks, and
the Si2157 is later read at the same I2C address and register. A
device whose reply matches only one of the two bytes is therefore
taken for a TDA18272. The driver has no frontend or tuner support for
the TDA18272, so frontend attach fails with -ENODEV and the device is
unusable.

Require both bytes, as the two-byte TUA9001 check above already does.

I found this while reviewing the driver with Claude Code. Not
reproduced on hardware; compile tested only (W=1 and sparse).

Fixes: 5cf6631e52ac ("[media] rtl28xxu: support for the rtl2832 demod driver")
Signed-off-by: Bilal Yazıcıoğlu <ahmetbilalyazicioglu@gmail.com>
---
 drivers/media/usb/dvb-usb-v2/rtl28xxu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/usb/dvb-usb-v2/rtl28xxu.c b/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
index d2957e4bf..b13a5ed0c 100644
--- a/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
+++ b/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
@@ -501,7 +501,7 @@ static int rtl2832u_read_config(struct dvb_usb_device *d)
 
 	/* check TDA18272 ID register; reg=00 val=c760  */
 	ret = rtl28xxu_ctrl_msg(d, &req_tda18272);
-	if (ret == 0 && (buf[0] == 0xc7 || buf[1] == 0x60)) {
+	if (ret == 0 && (buf[0] == 0xc7 && buf[1] == 0x60)) {
 		dev->tuner = TUNER_RTL2832_TDA18272;
 		dev->tuner_name = "TDA18272";
 		goto tuner_found;
-- 
2.56.0


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-12-03 14:13 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-12-03 14:12 [PATCH] media: rtl28xxu: require both TDA18272 ID bytes when probing Bilal Yazıcıoğlu

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

all inboxes | Powered by JetHome®