Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1322352yba; Tue, 2 Apr 2019 06:51:40 -0700 (PDT) X-Google-Smtp-Source: APXvYqyJG13lny5/dkkpy0j0cOOhOSiTnBpnIGQIzIio0I9A0c6qMdqkTwlGv85aRVqJZUB34qj+ X-Received: by 2002:a17:902:703:: with SMTP id 3mr36366515pli.224.1554213100252; Tue, 02 Apr 2019 06:51:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554213100; cv=none; d=google.com; s=arc-20160816; b=mD5wlbVUJ8c2/3n+KHVN4OKnP3mOrErzsfy4359x8kDzjnNsq9prsSudmoHX9In8D+ ifEvw/dr2ihddnzXW2/0/YEl74uoJgKT8VX9DkM8ta/UveX1vVt4X0dRElcg8CCV4Ghb XIGgLYVxBItpN9r+/SnBZhbzNAVKX5fEpAAr7fLM5i5+5ILO/qEFvR29VDKs39gSUwA2 NBHpmhwe8+OL8KiwfpoFMCy28fTn5QQ94O8KkQWgT+5T6Pd44k+6KsTjnnEKMdvPFafk RHbfUBpJtf0G5Be8mchy2y8v5/GmVqaAK+3O+9Fii86I0uOVqhkIleVZHHE/qjwUs/CG tIbg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:subject:message-id:date:cc:to :from:mime-version:content-transfer-encoding:content-disposition; bh=0B2/Wu/Y5fsJMoPdBscfmlqDz/VK3Ao3vNYM/xI3/DE=; b=lyqIWoviWKqRbMvkksoP+q5YJXECGTuicuQTe+sfJ5qTbmLpEHuixAmjEJB4+K18ix 9yx5its9Xdqg0ezDAkFkoF/jBVWGuXTQu4l3Hdt4lISri/RJZGqEifIdP8ZY7bXGk6OF iqhDvHNNdM4EzSvDfkDdIjYmJjkIEETpWFlbIUdlVxOGOrgrM92MMqDIpqaH/EkwGjHV ntE4kbhPaxIqcvw1qKLvd2tXFHBJk8B7d2NDMkLJOcX0u/Hbkzy2NZRpAr4CYJKd+zqO vj0UTkg1tLt4pp/cCp+OvYK1wtKPwqqX5XuVW8NoJb2a3+mDiJNcr2iu8fs/IxneaSVT xYlw== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k7si11062639pgi.451.2019.04.02.06.51.24; Tue, 02 Apr 2019 06:51:40 -0700 (PDT) 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732037AbfDBNsw (ORCPT + 99 others); Tue, 2 Apr 2019 09:48:52 -0400 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:42890 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731196AbfDBNkC (ORCPT ); Tue, 2 Apr 2019 09:40:02 -0400 Received: from [167.98.27.226] (helo=deadeye) by shadbolt.decadent.org.uk with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1hBJdw-0002nl-Go; Tue, 02 Apr 2019 14:40:00 +0100 Received: from ben by deadeye with local (Exim 4.92) (envelope-from ) id 1hBJdv-0004t4-BE; Tue, 02 Apr 2019 14:39:59 +0100 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, Denis Kirjanov , "Krzysztof Kozlowski" , "Linus Walleij" Date: Tue, 02 Apr 2019 14:38:27 +0100 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) X-Patchwork-Hint: ignore Subject: [PATCH 3.16 33/99] gpiolib: Fix return value of gpio_to_desc() stub if !GPIOLIB In-Reply-To: X-SA-Exim-Connect-IP: 167.98.27.226 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.16.65-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: Krzysztof Kozlowski commit c5510b8dafce5f3f5a039c9b262ebcae0092c462 upstream. If CONFIG_GPOILIB is not set, the stub of gpio_to_desc() should return the same type of error as regular version: NULL. All the callers compare the return value of gpio_to_desc() against NULL, so returned ERR_PTR would be treated as non-error case leading to dereferencing of error value. Fixes: 79a9becda894 ("gpiolib: export descriptor-based GPIO interface") Signed-off-by: Krzysztof Kozlowski Signed-off-by: Linus Walleij Signed-off-by: Ben Hutchings --- include/linux/gpio/consumer.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/include/linux/gpio/consumer.h +++ b/include/linux/gpio/consumer.h @@ -245,7 +245,7 @@ static inline int gpiod_to_irq(const str static inline struct gpio_desc *gpio_to_desc(unsigned gpio) { - return ERR_PTR(-EINVAL); + return NULL; } static inline int desc_to_gpio(const struct gpio_desc *desc) {