media: rtl28xxu: require both TDA18272 ID bytes when probing
Subsystems (2)
PATCH 1/1 media: rtl28xxu: require both TDA18272 ID bytes when probing
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).
--- drivers/media/usb/dvb-usb-v2/rtl28xxu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/usb/dvb-usb-v2/rtl28xxu.c +1 -1
@@ -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;
Signature · 1 line
2.56.0