From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BF5CDCCA47C for ; Wed, 29 Jun 2022 10:46:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231298AbiF2KqM (ORCPT ); Wed, 29 Jun 2022 06:46:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53458 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231276AbiF2KqL (ORCPT ); Wed, 29 Jun 2022 06:46:11 -0400 Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EE6993E0FA; Wed, 29 Jun 2022 03:46:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1656499568; x=1688035568; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=cjkwsHtE440LjbtD94TN0J5KYn4ACRbSIN99ZvYhneQ=; b=bOd/mx+AFDYQy3ibH0OWItvgMYqXziIuV1e5owV0MLjE4zM5Kq9jnOpG ofpB7psxcotdvoVajIeCjE80HhQcobJc1VFQRYvEE7qSTy+3tQlK5tDlF MQes3OMpgxqtT5YVd5L7DzB4Q8zCYmam/6V0HtbsLxwVtt7quN5vkKbZZ NeemSpxI+3CF4ozUXhuoZtaLiLNHrGZLFXl2mduHiISFAATP1198awCFj my0WRhQq+Ar/SSa6PQ/loxYp416CyVs1b8v2IPPw6ceG0xwLiSX7k0t82 8kFhmz26K6B8oylhIyzfyj15Xvldvile0xEcsEvRXBYSow2TyY69JQR0H A==; X-IronPort-AV: E=McAfee;i="6400,9594,10392"; a="345990538" X-IronPort-AV: E=Sophos;i="5.92,231,1650956400"; d="scan'208";a="345990538" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Jun 2022 03:46:08 -0700 X-IronPort-AV: E=Sophos;i="5.92,231,1650956400"; d="scan'208";a="658510336" Received: from smile.fi.intel.com ([10.237.72.54]) by fmsmga004-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Jun 2022 03:46:04 -0700 Received: from andy by smile.fi.intel.com with local (Exim 4.95) (envelope-from ) id 1o6VAj-000xd5-RM; Wed, 29 Jun 2022 13:43:49 +0300 Date: Wed, 29 Jun 2022 13:43:49 +0300 From: Andy Shevchenko To: Geert Uytterhoeven Cc: Phil Edworthy , Philipp Zabel , Wolfram Sang , Jarkko Nikula , Krzysztof Kozlowski , Sam Protsenko , Rob Herring , Sven Peter , Jan Dabros , Lukas Bulwahn , Tyrone Ting , Arnd Bergmann , Olof Johansson , Biju Das , Geert Uytterhoeven , Linux I2C , Linux-Renesas Subject: Re: [PATCH v2 2/2] i2c: Add Renesas RZ/V2M controller Message-ID: References: <20220628194526.111501-1-phil.edworthy@renesas.com> <20220628194526.111501-3-phil.edworthy@renesas.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org On Wed, Jun 29, 2022 at 08:52:27AM +0200, Geert Uytterhoeven wrote: > On Tue, Jun 28, 2022 at 11:08 PM Andy Shevchenko > wrote: > > On Tue, Jun 28, 2022 at 08:45:26PM +0100, Phil Edworthy wrote: ... > > > +static int rzv2m_i2c_send(struct rzv2m_i2c_priv *priv, struct i2c_msg *msg, > > > + unsigned int *count) > > > +{ > > > + unsigned int i; > > > + int ret = 0; > > > > Redundant assignment, you may return 0 directly. > > Can you prove msg->len is never zero, and the loop below is always > executed at least once? I don't see how this is related. The ret is used only in the loop body, return 0; outside will suffice. No? > The driver does set I2C_AQ_NO_ZERO_LEN, but I don't think the static > checkers know ;-) > > > > > > + for (i = 0; i < msg->len; i++) { > > > + ret = rzv2m_i2c_write_with_ack(priv, msg->buf[i]); > > > + if (ret < 0) > > > + return ret; > > > + } > > > + *count = i; > > > + > > > + return ret; > > > +} -- With Best Regards, Andy Shevchenko