From: Dan Carpenter <dan.carpenter@linaro.org>
To: Stefan Wahren <wahrenst@gmx.net>
Cc: Umang Jain <umang.jain@ideasonboard.com>,
linux-staging@lists.linux.dev, Dan Carpenter <error27@gmail.com>,
Kieran Bingham <kieran.bingham@ideasonboard.com>,
Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
Dave Stevenson <dave.stevenson@raspberrypi.com>,
Phil Elwell <phil@raspberrypi.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Subject: Re: [PATCH v2 1/2] staging: vchiq_core: Bubble up wait_event_interruptible() return value
Date: Wed, 3 Jul 2024 18:54:18 +0200 [thread overview]
Message-ID: <485a350b-2016-4ebc-ab07-a2a13e817526@suswa.mountain> (raw)
In-Reply-To: <2a5c162e-0036-4f3e-b946-bce549e08c54@gmx.net>
On Wed, Jul 03, 2024 at 06:18:19PM +0200, Stefan Wahren wrote:
> > + *
> > + * Returns: 0 on success, a negative error code on failure
Probably not even worth adding this comment. It's assumed.
> > */
> > static inline int
> > remote_event_wait(wait_queue_head_t *wq, struct remote_event *event)
> > {
> > + int ret = 0;
> > +
> > if (!event->fired) {
> > event->armed = 1;
> > dsb(sy);
> > - if (wait_event_interruptible(*wq, event->fired)) {
> > + ret = wait_event_interruptible(*wq, event->fired);
> > + if (ret) {
> > event->armed = 0;
> > - return 0;
> > + return ret;
> > }
> > event->armed = 0;
> > /* Ensure that the peer sees that we are not waiting (armed == 0). */
> > @@ -518,7 +523,7 @@ remote_event_wait(wait_queue_head_t *wq, struct remote_event *event)
> > }
> >
> > event->fired = 0;
> > - return 1;
> > + return ret;
> in general this patch looks good to me. But maybe we better return 0
> directly and reduce the scope of ret.
Heh. If I could have found some more things to complain about then I
was going to ask that this be changed to "return 0;" as well. But I
always feel like "ret" should be function scope. Otherwise you can get
multiple ret declarations in a function and it leads to not setting the
correct error code.
regards,
dan carpenter
next prev parent reply other threads:[~2024-07-03 16:54 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-03 13:10 [PATCH v2 0/2] staging: vchiq_core: Stop kthreads on module unload Umang Jain
2024-07-03 13:10 ` [PATCH v2 1/2] staging: vchiq_core: Bubble up wait_event_interruptible() return value Umang Jain
2024-07-03 16:18 ` Stefan Wahren
2024-07-03 16:54 ` Dan Carpenter [this message]
2024-07-03 13:10 ` [PATCH v2 2/2] staging: vc04_services: vchiq_core: Stop kthreads on vchiq module unload Umang Jain
2024-07-03 16:31 ` Stefan Wahren
2024-07-03 16:44 ` Umang Jain
2024-07-06 8:50 ` [PATCH v2 0/2] staging: vchiq_core: Stop kthreads on " Stefan Wahren
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=485a350b-2016-4ebc-ab07-a2a13e817526@suswa.mountain \
--to=dan.carpenter@linaro.org \
--cc=dave.stevenson@raspberrypi.com \
--cc=error27@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=kieran.bingham@ideasonboard.com \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-staging@lists.linux.dev \
--cc=phil@raspberrypi.com \
--cc=umang.jain@ideasonboard.com \
--cc=wahrenst@gmx.net \
/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