Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp1147696pxv; Fri, 9 Jul 2021 19:32:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwmvBf+bo/fqLscH6p90RuxbnSsVNNS9sNXa1kyG45wC1eU3g4NVyJfiDIL2Dtgq9cRB/tO X-Received: by 2002:aa7:c74e:: with SMTP id c14mr22661432eds.40.1625884319876; Fri, 09 Jul 2021 19:31:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625884319; cv=none; d=google.com; s=arc-20160816; b=OJI2BGP9XfCYiJG1ZF5y3Jh8hXSXqm5MVYKVgu3EbAIPwQ24Fp4kPL6Vavs4DQxvGW gxp5ktAwhUoMJsJmnsszdNMxA7EmyLUywXv0OS6aswt1rGx7DRq9HanM9/Tz2c1Nrbvs LCDDED7iKCtOhPVEjO3S2SfcV+qHytRixu5tDkRrc5zIpDVxCpTfdUMSNZDv+h0YQzZE gbyCEG7Apql23jo7E2wfbsvpaDIlrF+mKnsIMN0yFo3GDN/SXLEYo0qTphfS6rEgWmsf 5LARGuVYWrzcYl43De5Z2mpbOMZREiL7YoXNWfX0KCw4AihvOGG0B2STO+syKTOGerXo Xk1g== 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=pQZZ0TkgcT64RQClRIR9SYCRr5hxC3YvhVQDaUql96fW9dSRae7CfJmnZNnUrLMQza pkhZ2qDJMQLW2OoyLBez8+eWtnT8IdjtIyAQe5mxXogMbiwhViUIdsjS2BxlzG//xrvP lL+0MSihnomHiGnJvtnr1hz/PAnKLulNUvuDJ/NVmI7HvcswyHxM/RmJjGECvu/LAlhj mD56sS2G6WPE5U4iE83MQaIq66jyntoOPkE+N2ARaI+byDzNKxz2ZMSGTXlZ9xGr0a82 1wAODYWykhQYRRXpTMOA4GzHrfWXI65iO9SVFWQzrp1oACVipQe7WR0RRuWXxU0cmvnW dbCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=t1Ky3r4K; 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 d26si2384974edr.445.2021.07.09.19.31.37; Fri, 09 Jul 2021 19:31:59 -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=t1Ky3r4K; 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 S234181AbhGJCd3 (ORCPT + 99 others); Fri, 9 Jul 2021 22:33:29 -0400 Received: from mail.kernel.org ([198.145.29.99]:42924 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234330AbhGJC3W (ORCPT ); Fri, 9 Jul 2021 22:29:22 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 98A9861430; Sat, 10 Jul 2021 02:25:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1625883947; bh=kkzpB9mHtqsTDc8yH38cr0ZSYOzrQ8stVA5/0TR9GAE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=t1Ky3r4KF8Qu3tISqr/sKNNEzZPzrSmi32ZHudi5tS1VZlJ06Pdib+XmqN+EwLhz9 yEoZ+lZI/9JZg5VZEhVIFnJs+XINeHh8/W3JSC+m7qsjDLFDdbWgpwZ3biR4jiMn8+ YoEiL6UoBzQf6KbQa5cBZzqcBTh4mU6qDknFLhrKcwhFAOVES+dkUWl2Cni/B2B3DI zIoYUrGleeafcya0rdNRQ1MwaARt2Rjyzepmht9qOqtlvi4OsdmLqDqyA+tljF/9mE km/ZrbojdvshIM5cKn54+pYdot5cuhTzujWSPW2XfvrKnJVk8ooAM5D93oN7fwpcGf LqOoCcp5qbj3Q== 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.10 60/93] gpio: zynq: Check return value of irq_get_irq_data Date: Fri, 9 Jul 2021 22:23:54 -0400 Message-Id: <20210710022428.3169839-60-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210710022428.3169839-1-sashal@kernel.org> References: <20210710022428.3169839-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