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 X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 65F0BC4332F for ; Thu, 9 Sep 2021 13:17:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 46E5460F93 for ; Thu, 9 Sep 2021 13:17:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1359236AbhIINSr (ORCPT ); Thu, 9 Sep 2021 09:18:47 -0400 Received: from mga12.intel.com ([192.55.52.136]:7451 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344874AbhIINKF (ORCPT ); Thu, 9 Sep 2021 09:10:05 -0400 X-IronPort-AV: E=McAfee;i="6200,9189,10101"; a="200308534" X-IronPort-AV: E=Sophos;i="5.85,280,1624345200"; d="scan'208";a="200308534" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Sep 2021 06:03:08 -0700 X-IronPort-AV: E=Sophos;i="5.85,280,1624345200"; d="scan'208";a="525503166" Received: from smile.fi.intel.com (HELO smile) ([10.237.68.40]) by fmsmga004-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Sep 2021 06:03:05 -0700 Received: from andy by smile with local (Exim 4.95-RC2) (envelope-from ) id 1mOJhm-001crb-UK; Thu, 09 Sep 2021 16:03:02 +0300 Date: Thu, 9 Sep 2021 16:03:02 +0300 From: Andy Shevchenko To: Jacopo Mondi Cc: Jonathan Cameron , Lars-Peter Clausen , Matt Ranostay , Magnus Damm , linux-iio@vger.kernel.org, Peter Rosin , Wolfram Sang Subject: Re: [PATCH v5 3/4] iio: chemical: Add Senseair Sunrise 006-0-007 driver Message-ID: References: <20210909094537.218064-1-jacopo@jmondi.org> <20210909094537.218064-4-jacopo@jmondi.org> 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-iio@vger.kernel.org On Thu, Sep 09, 2021 at 04:01:48PM +0300, Andy Shevchenko wrote: > On Thu, Sep 09, 2021 at 11:45:36AM +0200, Jacopo Mondi wrote: > > + struct i2c_client *client = context; > > + union i2c_smbus_data data; > > + > > + /* Discard reg address from values count. */ > > + if (count < 1) > > + return -EINVAL; > > + count--; > > Wouldn't be more natural to decrement and then check against 0? Ah, count is of size_t. Then comparison < 1 is equal to !count. -- With Best Regards, Andy Shevchenko