Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp2142229ybf; Mon, 2 Mar 2020 02:53:26 -0800 (PST) X-Google-Smtp-Source: APXvYqy7t2kVljNMj9ywob7mkO8V6zKIhyEg1O3iBfeIb6fokbVRPhi/qEYCV1Bmeskt67nzapni X-Received: by 2002:a05:6808:45:: with SMTP id v5mr10635705oic.90.1583146406212; Mon, 02 Mar 2020 02:53:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583146406; cv=none; d=google.com; s=arc-20160816; b=phVEb9pK/rABxXrum+o0eQCr5BfQKOeNK9NN2GdKUigvyDx/UhU61HAnsMGXLwfHdF 9/5Gi1yin2/c6zdJ5Wn64xaQa9JxGgyWR6pAd2TVXKJAcIt+qlfMRPo5by3h1nV4G1m8 bhGLKweYkuOgtKHHNlrIx4VGR4CQLw/z5Q8x/whHJAlgdxlq+T/rTaLDadw4pWYDZGBK jJW56FWhssb7GAsGcmm2kE/z6s/eZAnMF7wuiCzwI1JYu1I+rWhF+mCp3S7DfqNllHGu dVxSC/u7EniuupyoyYYPlu+cR90caEvy5/UiIkipLws7L9U4/6DV+STrLyCgnL+TwX4T jM5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:organization:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=gTz3NDA8kLisUw8qcjvv1Ph2NJuituTsPYulWxkRrwg=; b=kBX7z8GFoTlQli8krcE6HhnAav1fBd6ZFEJpRIbP/huX+s1td5R0E7kXRiKs0Al016 4rvxDgJSjcuxQi6NTSwejbgFAwUMP/opxc5IGqz/S1BbHIsom1amDt63gRlwV7ut5WE4 /YXQ4wWnMhYLItpaxitTEos5Ae3CEuKQKpCYVm/WGYgTma1RF8IauMHPWuPQxb325+v3 ILKcc8E1qADiYeJwQKpjxHQ8Q8JNe4l1s5YRC3F3n7HlfVDO6FUHQ2w2nS/5z/sYRWZX IVDOlU2tXNNPX84liL2vjwAY/TpzwZAHr5m+oJoY9TyE4je1N+XEcKC/WNk89y/29kUT 0tpw== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a205si6096543oif.159.2020.03.02.02.53.13; Mon, 02 Mar 2020 02:53:26 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727619AbgCBKxK (ORCPT + 99 others); Mon, 2 Mar 2020 05:53:10 -0500 Received: from mga06.intel.com ([134.134.136.31]:54599 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727027AbgCBKxJ (ORCPT ); Mon, 2 Mar 2020 05:53:09 -0500 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 02 Mar 2020 02:53:09 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,506,1574150400"; d="scan'208";a="228373133" Received: from smile.fi.intel.com (HELO smile) ([10.237.68.40]) by orsmga007.jf.intel.com with ESMTP; 02 Mar 2020 02:53:07 -0800 Received: from andy by smile with local (Exim 4.93) (envelope-from ) id 1j8ihB-0066wg-NL; Mon, 02 Mar 2020 12:53:09 +0200 Date: Mon, 2 Mar 2020 12:53:09 +0200 From: Andy Shevchenko To: Geert Uytterhoeven Cc: Linus Walleij , Bartosz Golaszewski , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] gpiolib: Fix inverted check in gpiochip_remove() Message-ID: <20200302105309.GP1224808@smile.fi.intel.com> References: <20200302082448.11795-1-geert+renesas@glider.be> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200302082448.11795-1-geert+renesas@glider.be> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Mar 02, 2020 at 09:24:48AM +0100, Geert Uytterhoeven wrote: > The optimization to check for requested lines actually optimized for the > uncomon error case, where one of the GPIO lines is still in use. > Hence the error message must be printed when the loop is terminated > early, not when it went through all available GPIO lines. > > Fixes: 869233f81337bfb3 ("gpiolib: Optimize gpiochip_remove() when check for requested line") > Signed-off-by: Geert Uytterhoeven > --- > Noticed by review, tested by creating and destroying an otherwise unused > GPIO aggregator, which triggers: > > gpio gpiochip8: REMOVING GPIOCHIP WITH GPIOS STILL REQUESTED Thank you! Acked-by: Andy Shevchenko Linus, see below. > --- > drivers/gpio/gpiolib.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c > index 4e78bdc2739693c3..6180cf84fab7ce5e 100644 > --- a/drivers/gpio/gpiolib.c > +++ b/drivers/gpio/gpiolib.c > @@ -1823,7 +1823,7 @@ void gpiochip_remove(struct gpio_chip *chip) > } > spin_unlock_irqrestore(&gpio_lock, flags); > > - if (i == gdev->ngpio) > + if (i != gdev->ngpio) I prefer more explicit <. I had sent a patch (before I noticed this), so it's up to Linus which one to choose. > dev_crit(&gdev->dev, > "REMOVING GPIOCHIP WITH GPIOS STILL REQUESTED\n"); > > -- > 2.17.1 > -- With Best Regards, Andy Shevchenko