linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sean Young <sean@mess.org>
To: "Stefan Brüns" <stefan.bruens@rwth-aachen.de>
Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Antti Palosaari <crope@iki.fi>
Subject: Re: [PATCH 1/3] media: dvb-usb-v2: Report error on all error paths
Date: Sun, 19 May 2019 11:17:33 +0100	[thread overview]
Message-ID: <20190519101733.qaef5ricdqnmlf73@gofer.mess.org> (raw)
In-Reply-To: <f58ff4ca-9b9e-44af-a617-cdaa9e71f15f@rwthex-w2-a.rwth-ad.de>

Hi Stefan,

On Fri, Apr 12, 2019 at 03:12:58AM +0200, Stefan Brüns wrote:
> actual_length != wlen is the only error path which does not generate an
> error message. Adding an error message here allows to report a more
> specific error and to remove the error reporting from the call sites.
> 
> Also clean up the error paths - in case of an error, the remaining
> code is skipped, and ret is returned. Skip setting ret and return
> immediately (no cleanup necessary).

There is no Signed-off-by: line:

https://www.kernel.org/doc/html/latest/process/submitting-patches.html?highlight=signed%20off#sign-your-work-the-developer-s-certificate-of-origin

This is needed for merging. 

Sean

> ---
>  drivers/media/usb/dvb-usb-v2/dvb_usb_urb.c | 15 ++++++++++-----
>  1 file changed, 10 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/media/usb/dvb-usb-v2/dvb_usb_urb.c b/drivers/media/usb/dvb-usb-v2/dvb_usb_urb.c
> index 5bafeb6486be..5b32d159f968 100644
> --- a/drivers/media/usb/dvb-usb-v2/dvb_usb_urb.c
> +++ b/drivers/media/usb/dvb-usb-v2/dvb_usb_urb.c
> @@ -37,14 +37,19 @@ static int dvb_usb_v2_generic_io(struct dvb_usb_device *d,
>  	ret = usb_bulk_msg(d->udev, usb_sndbulkpipe(d->udev,
>  			d->props->generic_bulk_ctrl_endpoint), wbuf, wlen,
>  			&actual_length, 2000);
> -	if (ret < 0)
> +	if (ret) {
>  		dev_err(&d->udev->dev, "%s: usb_bulk_msg() failed=%d\n",
>  				KBUILD_MODNAME, ret);
> -	else
> -		ret = actual_length != wlen ? -EIO : 0;
> +		return ret;
> +	}
> +	if (actual_length != wlen) {
> +		dev_err(&d->udev->dev, "%s: usb_bulk_msg() write length=%d, actual=%d\n",
> +				KBUILD_MODNAME, wlen, actual_length);
> +		return -EIO;
> +	}
>  
> -	/* an answer is expected, and no error before */
> -	if (!ret && rbuf && rlen) {
> +	/* an answer is expected */
> +	if (rbuf && rlen) {
>  		if (d->props->generic_bulk_ctrl_delay)
>  			usleep_range(d->props->generic_bulk_ctrl_delay,
>  					d->props->generic_bulk_ctrl_delay
> -- 
> 2.21.0

  reply	other threads:[~2019-05-19 17:26 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20190412011300.5468-1-stefan.bruens@rwth-aachen.de>
2019-04-12  1:12 ` [PATCH 1/3] media: dvb-usb-v2: Report error on all error paths Stefan Brüns
2019-05-19 10:17   ` Sean Young [this message]
2019-04-12  1:12 ` [PATCH 2/3] media: dvbsky: Remove duplicate error reporting for dvbsky_usb_generic_rw Stefan Brüns
2019-04-12  1:13 ` [PATCH 3/3] media: af9035: " Stefan Brüns

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=20190519101733.qaef5ricdqnmlf73@gofer.mess.org \
    --to=sean@mess.org \
    --cc=crope@iki.fi \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=stefan.bruens@rwth-aachen.de \
    /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;
as well as URLs for NNTP newsgroup(s).