Skip to contentSkip to conversation

media: cx2341x: Check return value of cx2341x_api()

PATCH In review Daniil Dulov 2 participants 2 messages Feb 11, 2024 – Feb 12, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 media: cx2341x: Check return value of cx2341x_api()

cx2341x_api() may return an error, so add a check.

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

Fixes 45ad9f8b44b0 ("V4L/DVB (4202): allow selecting CX2341x port mode")
---
 drivers/media/common/cx2341x.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/media/common/cx2341x.c +4 -1
index 1f67e021138f..fa888d7c3988 100644
@@ -1035,7 +1035,10 @@ int cx2341x_update(void *priv, cx2341x_mbox_func func,
 	};
 	int err;
 
-	cx2341x_api(priv, func, CX2341X_ENC_SET_OUTPUT_PORT, 2, new->port, 0);
+	err = cx2341x_api(priv, func, CX2341X_ENC_SET_OUTPUT_PORT, 2, new->port, 0);
+
+    if (err)
+	    return err;
 
 	if (!old ||
 	    CMP_FIELD(old, new, is_50hz)) {
Signature · 1 line
2.25.1
#1 lore raw
Quoted 15 lines · Daniil Dulov

cx2341x_api() may return an error, so add a check.

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

Fixes 45ad9f8b44b0 ("V4L/DVB (4202): allow selecting CX2341x port mode")
---
 drivers/media/common/cx2341x.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/media/common/cx2341x.c +0 -0
index 1f67e021138f..fa888d7c3988 100644

drivers/media/common/cx2341x.c int cx2341x_update(void *priv, cx2341x_mbox_func func, · line 1041

Quoted 8 lines
drivers/media/common/cx2341x.c +4 -1
@@ -1035,7 +1035,10 @@ int cx2341x_update(void *priv, cx2341x_mbox_func func,
 	};
 	int err;
 
-	cx2341x_api(priv, func, CX2341X_ENC_SET_OUTPUT_PORT, 2, new->port, 0);
+	err = cx2341x_api(priv, func, CX2341X_ENC_SET_OUTPUT_PORT, 2, new->port, 0);
+
+    if (err)
+	    return err;

Indentation is all over the place, please fix!

Regards,

Hans

Quoted 3 lines
drivers/media/common/cx2341x.c +0 -0
 	if (!old ||
 	    CMP_FIELD(old, new, is_50hz)) {