mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Bilal Yazıcıoğlu" <ahmetbilalyazicioglu@gmail.com>
To: linux-media@vger.kernel.org
Cc: "Mauro Carvalho Chehab" <mchehab@kernel.org>,
	"Antti Palosaari" <crope@iki.fi>,
	linux-kernel@vger.kernel.org,
	"Bilal Yazıcıoğlu" <ahmetbilalyazicioglu@gmail.com>
Subject: [PATCH] media: rtl28xxu: require both TDA18272 ID bytes when probing
Date: Thu,  3 Dec 2026 17:12:58 +0300	[thread overview]
Message-ID: <20261203141258.37538-1-ahmetbilalyazicioglu@gmail.com> (raw)

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


                 reply	other threads:[~2026-12-03 14:13 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20261203141258.37538-1-ahmetbilalyazicioglu@gmail.com \
    --to=ahmetbilalyazicioglu@gmail.com \
    --cc=crope@iki.fi \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.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

all inboxes | Powered by JetHome®