Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp4133895yba; Sun, 19 May 2019 11:31:32 -0700 (PDT) X-Google-Smtp-Source: APXvYqwhmGVe407pOiZZAHozsQvLzQtjXpw9InA3w1LpND/8stehBIqZaJkAFnYNO8a3BKZirLwt X-Received: by 2002:a17:902:bb06:: with SMTP id l6mr12986560pls.78.1558290692438; Sun, 19 May 2019 11:31:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558290692; cv=none; d=google.com; s=arc-20160816; b=wIsECqVH83oRYJ7SBoQh2hIq/ld/bBcFQFEDqJkfvJxUsjlHcFGZt8tDCBIjw4PuXc NpJBjKCdfUUUQQ4aldtDiqxeg8GWZoQ/SBeeSoT2/54HKTb6MrmyjeL8VichPKPO49/1 xr7XPiPxVG9qd9YqHqEVGGYxU4FAPDqweoJUETtLSXgtrA+kuQvH6T2A+vdGYJRmLour Atw8d2juPdIqNUHOyZVN58mqVFlthl9cexOIHgiKyESNzMUB/nwDIib7Yj/zJhNLubCQ GbvEQqACMtVSu5srJKIufuoTnIjtedkaU/x7rUzM+AWHVdUV924veeRn458b4B0hT9Il u+IQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=82rPNdm7ZwHN4uUD8aVZ8Z5ND2ZeRoWccgL0ucjGwjI=; b=meRIAcsU20yKemEcOp01D8Hy6oDRg1kCtUqbOTbV97vaj65/0GYgw1zVv2WVu1Egaz ib52CqjZIu+I03lpavKwwuIVnM9bG1VmPbnHQhC9v2a1qCYSJvNn31X60g4Uf2ySq75X qS+U89dzkyQpync8kvf9pzjl2mAflxOIa9Txcm+JFAgNDr42IaFX7yM/7+ARwfaYnAfq qQ/i1GTbd7pkBGEoMNLPp6sP2dZJWgMCniYNk22IdAdq7aNEg1Loa4yV3VE/qM3m+R4M sowxGOC2snlKazGe6f8vzTrptyjemILAq8HYEA3zolS52/9I0/UGMSInWYYP8EKqqRPo F5+Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p23si11293996pgj.356.2019.05.19.11.31.16; Sun, 19 May 2019 11:31:32 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727112AbfESR0v (ORCPT + 99 others); Sun, 19 May 2019 13:26:51 -0400 Received: from gofer.mess.org ([88.97.38.141]:35459 "EHLO gofer.mess.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726607AbfESR0u (ORCPT ); Sun, 19 May 2019 13:26:50 -0400 Received: by gofer.mess.org (Postfix, from userid 1000) id 13CF460ADD; Sun, 19 May 2019 11:17:33 +0100 (BST) Date: Sun, 19 May 2019 11:17:33 +0100 From: Sean Young To: Stefan =?iso-8859-1?Q?Br=FCns?= Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Mauro Carvalho Chehab , Antti Palosaari Subject: Re: [PATCH 1/3] media: dvb-usb-v2: Report error on all error paths Message-ID: <20190519101733.qaef5ricdqnmlf73@gofer.mess.org> References: <20190412011300.5468-1-stefan.bruens@rwth-aachen.de> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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