Received: by 10.223.185.116 with SMTP id b49csp3839798wrg; Tue, 6 Mar 2018 05:58:30 -0800 (PST) X-Google-Smtp-Source: AG47ELt4wNqiHHN4T6Qygix0UpovFaVppg4ruT7+Q64rKoL3cTla/YagO6qbw8iqf+hf5yO/M1to X-Received: by 10.101.64.10 with SMTP id f10mr14776570pgp.171.1520344710709; Tue, 06 Mar 2018 05:58:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520344710; cv=none; d=google.com; s=arc-20160816; b=BTTGKP3PFEnIRTzUwcIdZ89cgfuxbQHJmlfM33Lc+J+VQ7nyMazwP5HiCDJvKOBmou p/A1knhmtgEbV4mwui/hoDhEk3qP/h0Yo7sC7nqw/wSxzwGIOxLtowFsP2N1kkFayWgd KVsDxVsLnub961iMpII+eqYct60s8QfGKFZeZEautdbgxNlJEY+lwVFtO1L40A212zMA nhmK8shuvffgev52LweUUxa+igARRH9LC7/5thnYZUp3N/norkJnE9mzKph9sOWB0UPz GcoPnWfNJOszjTMKoaWVyWMLGMOFUlQ7Yp/X6eeohGMHb2OuNNLIouZxz3c5sJn/QoDu XqEA== 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-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=TYOp1dcBRema3GhZ6vn87/BP+evJcQ15KgWX/ZgL8Sc=; b=ohNna68CVA33CHH1rfMhz8Y6QNJsZh/mdMZts5YJU6Z3K6FR9LBdA0S8esQm72EV0S 1KVR8sisz+NmLzxFhfX83LkrQC/5bz5bLvwRXPNUFWGVgh0vMj+Dm7QQZpnyiQvb5hrq izF/7KP2boKvPpmGOiRVLeYhooMwqfHlBhWokS44bBsvvCALyrfdbD5ihJ7HCM56T3nw DghnZ2ggsyiaACfYSZdwWGQVLnUER9zQTXdOYqZQpkS5siCbncVflzE17F6zQ5VJ1+oF ktyOE1E4BtkTuYNHelibjXnAGauUyPAnOXIctkGnjtuioNl5md+YLHyKjhZCIO4xy0Nc woBQ== 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 t1si9923967pgs.618.2018.03.06.05.58.16; Tue, 06 Mar 2018 05:58:30 -0800 (PST) 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 S932773AbeCFN5E (ORCPT + 99 others); Tue, 6 Mar 2018 08:57:04 -0500 Received: from mga09.intel.com ([134.134.136.24]:18266 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753507AbeCFN5B (ORCPT ); Tue, 6 Mar 2018 08:57:01 -0500 X-Amp-Result: UNSCANNABLE X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 06 Mar 2018 05:57:01 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.47,431,1515484800"; d="scan'208";a="35017755" Received: from paasikivi.fi.intel.com ([10.237.72.42]) by fmsmga004.fm.intel.com with ESMTP; 06 Mar 2018 05:56:59 -0800 Received: by paasikivi.fi.intel.com (Postfix, from userid 1000) id 8B19D2090E; Tue, 6 Mar 2018 15:56:58 +0200 (EET) Date: Tue, 6 Mar 2018 15:56:58 +0200 From: Sakari Ailus To: Mauro Carvalho Chehab Cc: Todor Tomov , hverkuil@xs4all.nl, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/2] media: ov5645: Fix write_reg return code Message-ID: <20180306135658.dh5vlmsevodrcr7m@paasikivi.fi.intel.com> References: <1518082920-11309-1-git-send-email-todor.tomov@linaro.org> <20180306104010.234737a6@vento.lan> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180306104010.234737a6@vento.lan> 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 Mauro, On Tue, Mar 06, 2018 at 10:40:10AM -0300, Mauro Carvalho Chehab wrote: > Em Thu, 8 Feb 2018 11:41:59 +0200 > Todor Tomov escreveu: > > > I2C transfer functions return number of successful operations (on success). > > > > Do not return the received positive return code but instead return 0 on > > success. The users of write_reg function already use this logic. > > > > Signed-off-by: Todor Tomov > > --- > > drivers/media/i2c/ov5645.c | 6 ++++-- > > 1 file changed, 4 insertions(+), 2 deletions(-) > > > > diff --git a/drivers/media/i2c/ov5645.c b/drivers/media/i2c/ov5645.c > > index d28845f..9755562 100644 > > --- a/drivers/media/i2c/ov5645.c > > +++ b/drivers/media/i2c/ov5645.c > > @@ -600,11 +600,13 @@ static int ov5645_write_reg(struct ov5645 *ov5645, u16 reg, u8 val) > > regbuf[2] = val; > > > > ret = i2c_master_send(ov5645->i2c_client, regbuf, 3); > > - if (ret < 0) > > + if (ret < 0) { > > dev_err(ov5645->dev, "%s: write reg error %d: reg=%x, val=%x\n", > > __func__, ret, reg, val); > > + return ret; > > + } > > Actually, if ret < 3, it should return an error too (like -EREMOTEIO > or -EIO). i2c_master_send() always returns a negative error code or the number of octets written. But thank you for reminding me about the patch. :-) -- Regards, Sakari Ailus sakari.ailus@linux.intel.com