Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp3997133pxu; Mon, 30 Nov 2020 15:14:51 -0800 (PST) X-Google-Smtp-Source: ABdhPJx10c0N97VCBn2ddDRMe0VDtbvC5ZVT5bpLyeCRYstzLbZJ3fHmHla0A+mK+No3RWe2dFtk X-Received: by 2002:a50:a444:: with SMTP id v4mr30343edb.175.1606778090799; Mon, 30 Nov 2020 15:14:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606778090; cv=none; d=google.com; s=arc-20160816; b=IoS8x/FFWuqCJkzgE5CS/k8iowtRHgVJoEIUf1Tc4X0kPHQQQXKKpyvrz8BCi4hZdD Tv9vVY6hBN/BEyktMB9WpL2GNis5XJ/wNaou4itnWT7qiokw+rwGy95+bxdKls18Tmot WGh4j8L+fYd+Ld1jZ9ftZGmm8IXFDlybIcAtMo3SNwUstfZTWEjwgtnEXBJVWDzVCgT4 v3sJcbzWA8E7nfc2Lqjv+dJduEikC8Tmub34ZOx8mZL7QP9TRZttudUwYy6L+aBsDDXH ovfpp3W2oXFrdmxPpwoC2ORDzh55fzE1aQmDYKJ5lOIkHEkmCdLavGXT7jJmLlw8sWnz c8gw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:references:mime-version :message-id:in-reply-to:date:sender:dkim-signature; bh=mFKhjbWpDLNsHACLGmSHDXeR1f1UUpzNDZei7Sfx4p4=; b=McdrUM6/f8HIBbldCoACtHLb1pCMeYh+nTVcdvWdHy35MQo1SPBJprVxDfououAnwW kz8KPug62tUZQdVwaWzXyBnQodaLzxa6FUR1JL1j63zMSigmn7jd4wfdesznUa2cEFsI 3rZ1+CzmNG0nDHHAd8Mtvybs7gHUc9x7RR5b6swbQh08RX8c283TfYPkzavX1nJAWDvj btFfDNASxVXcMkh0r81FspLwMDVkX0dLMUAgxEYYjhlDw7qL6Cg25Sx0lMQnsr1iKe+L eJqjcbv1bYKaiHjO1j6IrholBavotY+XscmqV4UvjGehE16eKjzEey+pqpcu+vMZSj21 3v7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=MvulgOGV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f5si11520181edw.358.2020.11.30.15.14.28; Mon, 30 Nov 2020 15:14:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=MvulgOGV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388358AbgK3Ws7 (ORCPT + 99 others); Mon, 30 Nov 2020 17:48:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40758 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388248AbgK3Wsz (ORCPT ); Mon, 30 Nov 2020 17:48:55 -0500 Received: from mail-pj1-x104a.google.com (mail-pj1-x104a.google.com [IPv6:2607:f8b0:4864:20::104a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9423BC0613D4 for ; Mon, 30 Nov 2020 14:48:15 -0800 (PST) Received: by mail-pj1-x104a.google.com with SMTP id p20so27510pjz.0 for ; Mon, 30 Nov 2020 14:48:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:date:in-reply-to:message-id:mime-version:references:subject :from:to:cc; bh=mFKhjbWpDLNsHACLGmSHDXeR1f1UUpzNDZei7Sfx4p4=; b=MvulgOGVVW08Vt/wL+I1C6I9oeDyrppJFT8uqQTNSjTwSd/sD6sBnUAWZxhuLLZE3y S4usiy+muEMGYxatq1U9Y7mfsJAU0ROb6yBoE/ltWahRxvIYhsdTSl0iW0IgWUjwY8jJ FoRhoC//fH/m6MGBlPGhrgB1RYZKIY+uOtYw1tgM5UrTMLP+hFBMhGfCH15rJRifI6a8 Q6fOxn9KP3TPygBiIyXm8u6qe+EjzsTCs2yMsw8e7/6N8plZIViv8JC95w0NgoI2XOVt jSDzBlWehVZ1mVm+BuLXcwzv1cw6ptJHYb+/L6NJ6eq1qrtyxaQpovPNIyH0hzOBcxya hB5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=mFKhjbWpDLNsHACLGmSHDXeR1f1UUpzNDZei7Sfx4p4=; b=mRyFWmVZIOZoGa8Aefs85o+l2bP09xOCcBu7LojP7siZ/v1os8wOSe3U+YNdZYbgOW mimoyemEzE+R3jqDw56Lgda8g1Ia0H9l1bnMYhGdM1Nx+xkg+Dqii+0E+ibUOZV1VKQZ MHfEfV7YpQKLaYVaM6YRVN6wx1FhfhGQAIRKSr3++onBazOekQpO42RU2niGhZNRgfEo /6ntGigKOXTwo33igk1Vhi32KhKFmtN4NlFWtxmtilb9J9xyrmy4vnX9ea3xSvkCE13a ak1ehK/Jw+a9Gp96+aUSYTYONh2ehcMz5thO2TZiSJPtKNS+FdmbrNk/FQeoJjwQvLM9 2bqQ== X-Gm-Message-State: AOAM533Oj6FpA39hKof9vuWncBJc07J5+IPmF6Tv07rQVh+ugmVmop6O iofPExHgKd6aGTVIRNptz98Q0UbHIQUV+vrLMAI= Sender: "willmcvicker via sendgmr" X-Received: from willmcvicker.c.googlers.com ([fda3:e722:ac3:10:24:72f4:c0a8:2dd0]) (user=willmcvicker job=sendgmr) by 2002:a17:902:724c:b029:d9:e964:c4a4 with SMTP id c12-20020a170902724cb02900d9e964c4a4mr20861397pll.82.1606776495078; Mon, 30 Nov 2020 14:48:15 -0800 (PST) Date: Mon, 30 Nov 2020 22:47:53 +0000 In-Reply-To: <20201130224753.1569357-1-willmcvicker@google.com> Message-Id: <20201130224753.1569357-2-willmcvicker@google.com> Mime-Version: 1.0 References: <20201130224753.1569357-1-willmcvicker@google.com> X-Mailer: git-send-email 2.29.2.454.gaff20da3a2-goog Subject: [PATCH v1 1/1] gpiolib: Don't free if pin ranges are not defined From: Will McVicker To: Linus Walleij , Bartosz Golaszewski , Thierry Reding Cc: Edmond Chung , Andrew Chant , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-team@android.com, Will McVicker Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Edmond Chung A similar check was added in gpiochip_generic_request, but not in free. This has caused an imbalance count of request vs. free calls to the pinctrl driver. This patch is targeted to fix that issue. Fixes: 2ab73c6d8323 ("gpio: Support GPIO controllers without pin-ranges") Signed-off-by: Edmond Chung Signed-off-by: Andrew Chant Signed-off-by: Will McVicker --- drivers/gpio/gpiolib.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index 089ddcaa9bc6..6e3c4d7a7d14 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -1806,6 +1806,11 @@ EXPORT_SYMBOL_GPL(gpiochip_generic_request); */ void gpiochip_generic_free(struct gpio_chip *gc, unsigned offset) { +#ifdef CONFIG_PINCTRL + if (list_empty(&gc->gpiodev->pin_ranges)) + return; +#endif + pinctrl_gpio_free(gc->gpiodev->base + offset); } EXPORT_SYMBOL_GPL(gpiochip_generic_free); -- 2.29.2.454.gaff20da3a2-goog