diff mbox series

[2/3] media: tuners: xc5000: fix error code handling in xc5000_attach()

Message ID 20240416114509.198069-2-r.smirnov@omp.ru (mailing list archive)
State New, archived
Headers show
Series [1/3] media: tuners: tda18271: fix error code handling in tda18271_attach() | expand

Commit Message

Roman Smirnov April 16, 2024, 11:45 a.m. UTC
xc5000_attach() uses the hybrid_tuner_request_state() macro.
It may return the error code -ENOMEM, but the function handle
the value 0 instead.

Found by Linux Verification Center (linuxtesting.org) with Svace.

Fixes: b9302fa7ed97 ("media: tuners: fix error return code of hybrid_tuner_request_state()")
Signed-off-by: Roman Smirnov <r.smirnov@omp.ru>
---
 drivers/media/tuners/xc5000.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Sergey Shtylyov April 16, 2024, 6:58 p.m. UTC | #1
On 4/16/24 2:45 PM, Roman Smirnov wrote:

> xc5000_attach() uses the hybrid_tuner_request_state() macro.
> It may return the error code -ENOMEM, but the function handle

   Handles (just noticed that grammar issue in all 3 patches).

> the value 0 instead.
> 
> Found by Linux Verification Center (linuxtesting.org) with Svace.
> 
> Fixes: b9302fa7ed97 ("media: tuners: fix error return code of hybrid_tuner_request_state()")
> Signed-off-by: Roman Smirnov <r.smirnov@omp.ru>

Reviewed-by: Sergey Shtylyov <s.shtylyov@omp.ru>

[...]

MBR, Sergey
diff mbox series

Patch

diff --git a/drivers/media/tuners/xc5000.c b/drivers/media/tuners/xc5000.c
index 2182e5b7b606..6e47edee8ac3 100644
--- a/drivers/media/tuners/xc5000.c
+++ b/drivers/media/tuners/xc5000.c
@@ -1379,7 +1379,7 @@  struct dvb_frontend *xc5000_attach(struct dvb_frontend *fe,
 					      hybrid_tuner_instance_list,
 					      i2c, cfg->i2c_address, "xc5000");
 	switch (instance) {
-	case 0:
+	case -ENOMEM:
 		goto fail;
 	case 1:
 		/* new tuner instance */