From patchwork Tue Oct 16 19:06:04 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jesper Juhl X-Patchwork-Id: 1602281 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 2F1B33FCFC for ; Tue, 16 Oct 2012 19:06:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932109Ab2JPTGI (ORCPT ); Tue, 16 Oct 2012 15:06:08 -0400 Received: from 1010ds2-suoe.0.fullrate.dk ([90.184.90.115]:17851 "EHLO swampdragon.chaosbits.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932087Ab2JPTGH (ORCPT ); Tue, 16 Oct 2012 15:06:07 -0400 Received: by swampdragon.chaosbits.net (Postfix, from userid 1000) id D7F7F9403D; Tue, 16 Oct 2012 21:06:04 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by swampdragon.chaosbits.net (Postfix) with ESMTP id CCD669403B; Tue, 16 Oct 2012 21:06:04 +0200 (CEST) Date: Tue, 16 Oct 2012 21:06:04 +0200 (CEST) From: Jesper Juhl To: Ezequiel Garcia cc: Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] [media] stk1160: Check return value of stk1160_read_reg() in stk1160_i2c_read_reg() In-Reply-To: Message-ID: References: User-Agent: Alpine 2.00 (LNX 1167 2008-08-23) MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org On Mon, 15 Oct 2012, Ezequiel Garcia wrote: > On Mon, Oct 15, 2012 at 9:03 PM, Jesper Juhl wrote: > > On Mon, 15 Oct 2012, Ezequiel Garcia wrote: > > > >> On Mon, Oct 15, 2012 at 7:52 PM, Jesper Juhl wrote: > >> > On Mon, 15 Oct 2012, Jesper Juhl wrote: > >> > > >> >> On Sat, 13 Oct 2012, Ezequiel Garcia wrote: > >> >> > > [...] > >> > Currently there are two checks for 'rc' being less than zero with no > >> > change to 'rc' between the two, so the second is just dead code. > >> > The intention seems to have been to assign the return value of > >> > 'stk1160_read_reg()' to 'rc' before the (currently dead) second check > >> > and then test /that/. This patch does that. > >> > > >> > >> This is an overly complicated explanation for such a small patch. > >> Can you try to simplify it? > >> > > How's this? > > > > > > From: Jesper Juhl > > Date: Sat, 13 Oct 2012 00:16:37 +0200 > > Subject: [PATCH] [media] stk1160: Check return value of stk1160_read_reg() in stk1160_i2c_read_reg() > > > > Remember to collect the exit status from 'stk1160_read_reg()' in 'rc' > > before testing it for less than zero. > > > > Signed-off-by: Jesper Juhl > > --- > > drivers/media/usb/stk1160/stk1160-i2c.c | 3 +-- > > 1 files changed, 1 insertions(+), 2 deletions(-) > > > > diff --git a/drivers/media/usb/stk1160/stk1160-i2c.c b/drivers/media/usb/stk1160/stk1160-i2c.c > > index 176ac93..a2370e4 100644 > > --- a/drivers/media/usb/stk1160/stk1160-i2c.c > > +++ b/drivers/media/usb/stk1160/stk1160-i2c.c > > @@ -116,10 +116,9 @@ static int stk1160_i2c_read_reg(struct stk1160 *dev, u8 addr, > > if (rc < 0) > > return rc; > > > > - stk1160_read_reg(dev, STK1160_SBUSR_RD, value); > > + rc = stk1160_read_reg(dev, STK1160_SBUSR_RD, value); > > if (rc < 0) > > return rc; > > - > ^^^^^^^^^^^^^^^^^^^^^^^^ > Sorry for the nitpick, but I'd like you to *not* remove this line. > No problem. I hope the below is OK :-) From: Jesper Juhl Date: Sat, 13 Oct 2012 00:16:37 +0200 Subject: [PATCH] [media] stk1160: Check return value of stk1160_read_reg() in stk1160_i2c_read_reg() Remember to collect the exit status from 'stk1160_read_reg()' in 'rc' before testing it for less than zero. Signed-off-by: Jesper Juhl Acked-by: Ezequiel Garcia --- drivers/media/usb/stk1160/stk1160-i2c.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/media/usb/stk1160/stk1160-i2c.c b/drivers/media/usb/stk1160/stk1160-i2c.c index 176ac93..850cf28 100644 --- a/drivers/media/usb/stk1160/stk1160-i2c.c +++ b/drivers/media/usb/stk1160/stk1160-i2c.c @@ -116,7 +116,7 @@ static int stk1160_i2c_read_reg(struct stk1160 *dev, u8 addr, if (rc < 0) return rc; - stk1160_read_reg(dev, STK1160_SBUSR_RD, value); + rc = stk1160_read_reg(dev, STK1160_SBUSR_RD, value); if (rc < 0) return rc;