Received: by 10.223.185.116 with SMTP id b49csp3824427wrg; Tue, 6 Mar 2018 05:41:33 -0800 (PST) X-Google-Smtp-Source: AG47ELtH69zrRPKU//QfguQKmbrKaqiUaITocyijQ3PjnGMI5rWOkzDj07UwqKjEtRypdzj5EHL9 X-Received: by 2002:a17:902:a610:: with SMTP id u16-v6mr16105878plq.293.1520343693841; Tue, 06 Mar 2018 05:41:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520343693; cv=none; d=google.com; s=arc-20160816; b=AV6wHQc7LsIu+6+0M6QepbtCUesLtsld+n3/shT0GDU0BnA42mECWqPlCXo+lujLrm qunWeZ8lGJT352V+RRgtaz4IR0Dj7dt5Zy3iFQLbd+F5E/Px+uhT5MNUFgAUcP1w75gG yIsjrYYqm4dZSc5VjE/kABpIZ78dxY7/irtLpHoVyd4wLUSP6nxsVngKGRiLPWnUQcMC P10QtfINaOlz7yyC5a4iaslJ0GguqydieYMRUUWh3P2r6uY6K/+iyA/GTpxpEJZeEzjQ 2L+7hsEQl2a9JxZdwWCUqZHCTr1ItsvGWHkP1D9ShirBwjJGbijMd6sJq1H73f39pCHV Gtag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature:arc-authentication-results; bh=aS0Y9ggPvDEJKfYZgDJuV4FP2lWenb5vbR1hn9l6Hk8=; b=kxVJLPKrjPt6FKzUlLQq1NVJiXdOHnDWwfOKHjZ9sarmxD84lLd/JNHFp+Wn+8Wetx 8MtnEH7yThT2QRFrtqDG8qIZGAwkQ3diWlWUOaz+kE5QoKDheQWRiT2xUYC8mMVoc2Ln A0cxOq7qZv72eS50LlwFvohSjoYIkIBxzr+XLP5M38udBOiS17ahQPX8kdIPaaI025fZ VDr1+eDPc/1q2eiP7WwaWea2YZ1E7QmVIe6hIldG1rdyHbP2FHP82wuwx/jd0U0/KjFD ujyrPzy+fDYqNtBQFxb3A808m2zFxutyJbrh7JOsH8BMAiimUulD4FzrV35Jvfbj5otW F9PA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=GrJ8kUos; 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 g66si8814710pfc.13.2018.03.06.05.41.10; Tue, 06 Mar 2018 05:41:33 -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; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=GrJ8kUos; 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 S1753559AbeCFNkR (ORCPT + 99 others); Tue, 6 Mar 2018 08:40:17 -0500 Received: from bombadil.infradead.org ([198.137.202.133]:48834 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753245AbeCFNkQ (ORCPT ); Tue, 6 Mar 2018 08:40:16 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Content-Transfer-Encoding: Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Subject:Cc:To: From:Date:Sender:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=aS0Y9ggPvDEJKfYZgDJuV4FP2lWenb5vbR1hn9l6Hk8=; b=GrJ8kUos4sEAqFZf/0aSE6wau I/SdPP7WqDQogQkbIzdHxzfWhGgJe4P2pke4VtezwpDTkRllu9VCSqj5ndpSUSGo3U951263lhCox REmn7NRb+5BYhhgOMIInAyP3Y3y2R+UnwvOqWY1HFTlxUsGII4UQCmt7eSwkKEohd/c0WuVvABG2B m6oA/w+Po9iddBt9zcvadBfl+ZtB9yABzE2a8w3O1Cqkq/mIuc1tYiBX4e7vmb4mKzZxrmYZe/raW CBYvyLnDll/024jBbbPCJO6NjdpCwqkxRnh5bkVjKSRNV3fLPWGal73wCxHePRJ8a/lvdWLQa7YKz smXUCnZFQ==; Received: from 177.43.25.174.dynamic.adsl.gvt.net.br ([177.43.25.174] helo=vento.lan) by bombadil.infradead.org with esmtpsa (Exim 4.89 #1 (Red Hat Linux)) id 1etCpB-0003J8-V9; Tue, 06 Mar 2018 13:40:14 +0000 Date: Tue, 6 Mar 2018 10:40:10 -0300 From: Mauro Carvalho Chehab To: Todor Tomov Cc: sakari.ailus@linux.intel.com, 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: <20180306104010.234737a6@vento.lan> In-Reply-To: <1518082920-11309-1-git-send-email-todor.tomov@linaro.org> References: <1518082920-11309-1-git-send-email-todor.tomov@linaro.org> X-Mailer: Claws Mail 3.15.1-dirty (GTK+ 2.24.32; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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). > > - return ret; > + return 0; > } > > static int ov5645_read_reg(struct ov5645 *ov5645, u16 reg, u8 *val) Thanks, Mauro