[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20190519101733.qaef5ricdqnmlf73@gofer.mess.org>
Date: Sun, 19 May 2019 11:17:33 +0100
From: Sean Young <sean@...s.org>
To: Stefan Brüns <stefan.bruens@...h-aachen.de>
Cc: linux-media@...r.kernel.org, linux-kernel@...r.kernel.org,
Mauro Carvalho Chehab <mchehab@...nel.org>,
Antti Palosaari <crope@....fi>
Subject: Re: [PATCH 1/3] media: dvb-usb-v2: Report error on all error paths
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
Powered by blists - more mailing lists