From: Markus Elfring <Markus.Elfring@web.de>
To: Quentin Deslandes <quentin.deslandes@itdev.co.uk>
Cc: "devel@driverdev.osuosl.org" <devel@driverdev.osuosl.org>,
Forest Bond <forest@alittletooquiet.net>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
LKML <linux-kernel@vger.kernel.org>,
kernel-janitors@vger.kernel.org
Subject: Re: staging: vt6656: Use common error handling code in vnt_alloc_bufs()
Date: Fri, 23 Aug 2019 19:24:07 +0200 [thread overview]
Message-ID: <10006e33-ed90-74ec-4d59-4074caf4ecd4@web.de> (raw)
In-Reply-To: <20190823145540.GA2536@qd-ubuntu>
Your patch remove redundant code, which is fine.
Thanks for your constructive feedback.
> code you changed was simple enough to be understand quickly. I think replacing
> it with a crossed goto (even if it remove redundant code) might not be the best
> option.
>
> A solution might be to move the second loop to the top of the function
I am unsure about the relevance of the loop ordering for the affected
resource allocations.
> so you should be able to replace the end of the cleanup calls with:
>
> enomem:
> ret = -ENOMEM;
> free_rx:
> vnt_free_rx_bufs(priv);
> return ret;
The exception handling can eventually adjusted another bit according
to your refactoring.
> This way, only a failed call to vnt_submit_rx_urb() should jump to free_rx,
It seems that a goto statement will still be needed in an error code
part by both discussed variants.
> another failed call should jump to enomem or previously defined
> label, so we can correctly forward errors.
This view sounds promising.
> With such solution it might be worth adding a comment to describe
> that all error should be ENOMEM except for vnt_submit_rx_urb().
Can this function implementation become clearer also without
such a comment?
Regards,
Markus
next prev parent reply other threads:[~2019-08-23 17:24 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-23 13:30 [PATCH] staging: vt6656: Use common error handling code in vnt_alloc_bufs() Markus Elfring
2019-08-23 14:55 ` Quentin Deslandes
2019-08-23 17:24 ` Markus Elfring [this message]
2019-08-24 10:46 ` Dan Carpenter
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=10006e33-ed90-74ec-4d59-4074caf4ecd4@web.de \
--to=markus.elfring@web.de \
--cc=devel@driverdev.osuosl.org \
--cc=forest@alittletooquiet.net \
--cc=gregkh@linuxfoundation.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=quentin.deslandes@itdev.co.uk \
/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