Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp820493ybl; Wed, 4 Dec 2019 11:25:06 -0800 (PST) X-Google-Smtp-Source: APXvYqx9ijJL7RRu4YKKZvnQkYY8k4X7cAaR9LO5QrDlGmqyTn+gS8+ePg7QBRT4kIVvYpFsBzHw X-Received: by 2002:a9d:4c88:: with SMTP id m8mr131156otf.12.1575487506045; Wed, 04 Dec 2019 11:25:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575487506; cv=none; d=google.com; s=arc-20160816; b=Ua/pdaR21TXahyUqRqgp/YaNELFHXXIzxWQLjIDbZ+pKmBglu7AahNro1GvTvq4LbG DTwtTzvIVzoqG2sT5uBsq08zczzoiV4s8yw1DXxlUCEfI+GlNmF8N5IwuxYw2ZpifN9V ipOkxDTDiBnfTcJQpC+tnZtMhtnuHkfekZFg+2qeTFwYx32YN+j0LJf71p1OqBqi/Tsm D/JcNNtVy68SwXCAFin3Z4B6fMBVRZvApuZsw6L9g0ll1z1DZnN+fcg65SFMSaupvgbG cmXshHSBWWlxHxINkrXKN1ZKOZDrY7VDgJ5lSvU1FvNDhOLu4Cg8c9nRoFjUxHK2etHK kpMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=W2x4I2ObhOv79xBPc1DYc+1VKoK2kPldZeHeuLfyNU4=; b=uaCyE3+3gMaL+K4i7rXWJdOJUC+qNTIXvn5rznh/ys/KsQ8VDQLwtCqmbKtsEQhrQP K5cj80ojnNg83Ple8L+71r8ldIBprjX9VlyWnwVYP//+adpwiujuL4rhVX0sEglkAS6/ SDhurJzQ8bffZnUaLIxw9BtKdSUvlB4WNDnZa1bH/vCyR8XVnEukeZvg9Rqy8Dqg/4DR 1nFm4Nof1FLFgykbQq/Juw604UIdNtyxZJJsA+LxX0UdffMypNdL2JbcFA2xQh28wN+v BOQrhVpJqCKugxcbhnkKOJd9D/vyfVCHXIsJjQeU5KifE24zQo7mtezKMfcnc9/uQsER Ybqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=E0s8I6sQ; 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 l5si4181375otb.140.2019.12.04.11.24.52; Wed, 04 Dec 2019 11:25:06 -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; dkim=pass header.i=@kernel.org header.s=default header.b=E0s8I6sQ; 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 S1731036AbfLDSLB (ORCPT + 99 others); Wed, 4 Dec 2019 13:11:01 -0500 Received: from mail.kernel.org ([198.145.29.99]:38782 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731347AbfLDSK6 (ORCPT ); Wed, 4 Dec 2019 13:10:58 -0500 Received: from localhost (unknown [217.68.49.72]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 224FB20833; Wed, 4 Dec 2019 18:10:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1575483057; bh=qiar1VaVBvPmu92UC81QiJx1uqOjg2HjOpaJCa2CW2c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=E0s8I6sQxy95tpWjCnrP2vpAcLGWFaR3i7i0ARLX4yr18xiF67SIGxDjXcGvxGZ03 BKx9katYKA69T0V4t5TafDaOcsahMz3MBJzMIcJgctAaib2iJkao5hL2M9yuQU+0R0 i14SA6c8xuEOjtk0fk+vNcwYR/LCZe4H8oJWz4Lw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Krzysztof Kozlowski , Linus Walleij , Sasha Levin Subject: [PATCH 4.9 033/125] gpiolib: Fix return value of gpio_to_desc() stub if !GPIOLIB Date: Wed, 4 Dec 2019 18:55:38 +0100 Message-Id: <20191204175321.006007556@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191204175308.377746305@linuxfoundation.org> References: <20191204175308.377746305@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Krzysztof Kozlowski [ Upstream commit c5510b8dafce5f3f5a039c9b262ebcae0092c462 ] 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: Sasha Levin --- include/linux/gpio/consumer.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/gpio/consumer.h b/include/linux/gpio/consumer.h index fb0fde686cb1f..4a9838feb0866 100644 --- a/include/linux/gpio/consumer.h +++ b/include/linux/gpio/consumer.h @@ -398,7 +398,7 @@ static inline int gpiod_to_irq(const struct gpio_desc *desc) 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) -- 2.20.1