Commit dd5f551b authored by Stefan Brüns's avatar Stefan Brüns Committed by Mauro Carvalho Chehab
Browse files

media: dvb-usb-v2: Report error on all error paths



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).

Signed-off-by: default avatarStefan Brüns <stefan.bruens@rwth-aachen.de>
Signed-off-by: default avatarSean Young <sean@mess.org>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
parent 6d0d1ff9
Loading
Loading
Loading
Loading
+10 −5
Original line number Diff line number Diff line
@@ -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