Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp1144288pxv; Fri, 9 Jul 2021 19:24:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxeTLRxAwx2Gh1JdoeRt3J5gp36r3Q07irOPdo+Z+wJ3E297GyURBbw3GaKXQwvfxNh323i X-Received: by 2002:a17:906:417:: with SMTP id d23mr2534054eja.5.1625883890999; Fri, 09 Jul 2021 19:24:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625883890; cv=none; d=google.com; s=arc-20160816; b=biynp+KhdNfLig+ANPv8a3qaUUgkZWOjdEdXPZSFG0GaHw1MnaPnRhLnycN/d9SPrL LrqdPGGH3kiKrLTLiTK+67f89ApcmZ6nVUs1/D6Q9+IseEXFR+apkremh+YvwxJRvrOh c/+bk2lPHT757GV4a76W9wZeZGeG0hlNx0IMHjtT+KYakaqnYovixTja2mqalRytc1b3 jNrjF17d+1n5Ou5W2QlIvrE8AHB6P6kiDrGQbxJqTgGFEiV/rAkRq0VSoEbfzAEJa8gN hnA/z/SKDS4NUYRUQEyR/DDHf1E0UREtKBBKaRWj9ASskhl/t5kW4N3LfAb610gt8/3D OQvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=TO566Tb0PgkGmXDAmAiKXR7qc3S6elv0EPuxOQkrBcc=; b=psstkVkIfWpodnd2aSq62rRpOo0kMmD5FjkkAtPldaKW48iYipRFSc9l//Sc2E0CH8 sO9Xh4UlZePyFdKqdJ41mqOeoByX5oshjxY2otLN6q4LEyoK/E49vDuwyW7ztJrw+nXB VJIKu6yNfiRkbRDpgIkIuPKFtvS8tVuVrmVS2lLl1W6m0jGculuYSF7pwyM4swcmY13y LobV9TZUDtGcwQw4ZSt7FF+ETYgUc8v1ZvUWcG7fk8M1JaPsa3/7rzw+FfLAlpYtfhen nDJjvdAx2DQELX3TSi+pK/HsQ+WMbwPGgtiX/+AsNiVtE3Od8pKDc2/bWcK60lmUZT68 oe0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=s8sOlP1C; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v22si8538310edw.374.2021.07.09.19.24.28; Fri, 09 Jul 2021 19:24:50 -0700 (PDT) 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=@kernel.org header.s=k20201202 header.b=s8sOlP1C; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233210AbhGJCXb (ORCPT + 99 others); Fri, 9 Jul 2021 22:23:31 -0400 Received: from mail.kernel.org ([198.145.29.99]:38684 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232838AbhGJCWL (ORCPT ); Fri, 9 Jul 2021 22:22:11 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 7CC18613EB; Sat, 10 Jul 2021 02:19:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1625883564; bh=kkzpB9mHtqsTDc8yH38cr0ZSYOzrQ8stVA5/0TR9GAE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=s8sOlP1CUkMI4+1aiOYKardLXNHxFqXc1aQb8CijYedy/uXj4MEt9+9B0Y9bCMyPc 30j/qHEthC/itO3lEuJt95JRp2rL8P59l1RNIHENvvmr8D6Wxsl+1Ip9WyhWGDTtuR tkleF4X3PoWSYgowU74/pbPwSkpritRM3+MMGiV0f729wC0rn/FCpeZ0uYSBC07W7O k8CX5Ra//OGrKnvUWQnm0Kh9MzjvqaA0N0hquJAJjZcZh7rvbXf1hlsRC7acx41/Vd 0L1nlmhz/a+HHYZZGn+oZhxXkkfNwHiMtjogSy80qTVNd0hgZLeiYkoQNPKWCvONv7 +DKoeDUvTsDUw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Srinivas Neeli , Bartosz Golaszewski , Sasha Levin , linux-gpio@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH AUTOSEL 5.13 071/114] gpio: zynq: Check return value of irq_get_irq_data Date: Fri, 9 Jul 2021 22:17:05 -0400 Message-Id: <20210710021748.3167666-71-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210710021748.3167666-1-sashal@kernel.org> References: <20210710021748.3167666-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Srinivas Neeli [ Upstream commit 35d7b72a632bc7afb15356f44005554af8697904 ] In two different instances the return value of "irq_get_irq_data" API was neither captured nor checked. Fixed it by capturing the return value and then checking for any error. Addresses-Coverity: "returned_null" Signed-off-by: Srinivas Neeli Signed-off-by: Bartosz Golaszewski Signed-off-by: Sasha Levin --- drivers/gpio/gpio-zynq.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/gpio/gpio-zynq.c b/drivers/gpio/gpio-zynq.c index fb8684d70fe3..c288a7502de2 100644 --- a/drivers/gpio/gpio-zynq.c +++ b/drivers/gpio/gpio-zynq.c @@ -736,6 +736,11 @@ static int __maybe_unused zynq_gpio_suspend(struct device *dev) struct zynq_gpio *gpio = dev_get_drvdata(dev); struct irq_data *data = irq_get_irq_data(gpio->irq); + if (!data) { + dev_err(dev, "irq_get_irq_data() failed\n"); + return -EINVAL; + } + if (!device_may_wakeup(dev)) disable_irq(gpio->irq); @@ -753,6 +758,11 @@ static int __maybe_unused zynq_gpio_resume(struct device *dev) struct irq_data *data = irq_get_irq_data(gpio->irq); int ret; + if (!data) { + dev_err(dev, "irq_get_irq_data() failed\n"); + return -EINVAL; + } + if (!device_may_wakeup(dev)) enable_irq(gpio->irq); -- 2.30.2