diff mbox series

[3/3] media: tuners: tuner_simple: fix error code handling in simple_tuner_attach()

Message ID 20240416114509.198069-3-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
simple_tuner_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/tuner-simple.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Sergey Shtylyov April 16, 2024, 6:31 p.m. UTC | #1
Hello!

   Should have been "tuner-simple:" in the subject... :-)

On 4/16/24 2:45 PM, Roman Smirnov wrote:

> simple_tuner_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>

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

[...]

MBR, Sergey
diff mbox series

Patch

diff --git a/drivers/media/tuners/tuner-simple.c b/drivers/media/tuners/tuner-simple.c
index 8fb186b25d6a..713ce2455910 100644
--- a/drivers/media/tuners/tuner-simple.c
+++ b/drivers/media/tuners/tuner-simple.c
@@ -1089,7 +1089,7 @@  struct dvb_frontend *simple_tuner_attach(struct dvb_frontend *fe,
 					      i2c_adap, i2c_addr,
 					      "tuner-simple");
 	switch (instance) {
-	case 0:
+	case -ENOMEM:
 		mutex_unlock(&tuner_simple_list_mutex);
 		return NULL;
 	case 1: