From: Karol Przybylski <karprzy7@gmail.com>
To: hverkuil@xs4all.nl, mchehab@kernel.org
Cc: Karol Przybylski <karprzy7@gmail.com>,
linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
skhan@linuxfoundation.org
Subject: [PATCH] media: cec: extron-da-hd-4k-plus: add return check for wait_for_completion*()
Date: Sun, 10 Nov 2024 13:58:13 +0100 [thread overview]
Message-ID: <20241110125814.1899076-1-karprzy7@gmail.com> (raw)
According to scheduler/completion.rst, return status of wait_for_completion*()
function variants should be checked or be accompanied by explanation.
I examined code in extron-da-hd-4k-plus.c and it does look like the return value
should be checked, but perhaps there is a reason for ignoring it.
I drafted a patch for this, but I'm not entirely sure how to approach error handling in this case.
Discovered in coverity, CID1599679
Signed-off-by: Karol Przybylski <karprzy7@gmail.com>
---
.../cec/usb/extron-da-hd-4k-plus/extron-da-hd-4k-plus.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/media/cec/usb/extron-da-hd-4k-plus/extron-da-hd-4k-plus.c b/drivers/media/cec/usb/extron-da-hd-4k-plus/extron-da-hd-4k-plus.c
index cfbfc4c1b2e6..83a790117411 100644
--- a/drivers/media/cec/usb/extron-da-hd-4k-plus/extron-da-hd-4k-plus.c
+++ b/drivers/media/cec/usb/extron-da-hd-4k-plus/extron-da-hd-4k-plus.c
@@ -559,9 +559,12 @@ static void extron_read_edid(struct extron_port *port)
extron->edid_reading = true;
- if (!extron_send_and_wait(extron, port, cmd, reply))
- wait_for_completion_killable_timeout(&extron->edid_completion,
+ if (!extron_send_and_wait(extron, port, cmd, reply)) {
+ ret = wait_for_completion_killable_timeout(&extron->edid_completion,
msecs_to_jiffies(1000));
+ if (ret < 0)
+ goto unlock;
+ }
if (port->edid_blocks) {
extron_parse_edid(port);
port->read_edid = true;
--
2.34.1
next reply other threads:[~2024-11-10 12:58 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-10 12:58 Karol Przybylski [this message]
2024-11-10 15:52 ` kernel test robot
2024-11-11 3:48 ` kernel test robot
2024-11-11 8:04 ` Hans Verkuil
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=20241110125814.1899076-1-karprzy7@gmail.com \
--to=karprzy7@gmail.com \
--cc=hverkuil@xs4all.nl \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=skhan@linuxfoundation.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®