Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp1146040pxv; Fri, 9 Jul 2021 19:28:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyUWUEQmkDJwfC5em5TihjtBg9jgFsIA6otEecH3D7/FQ+Ei4SaRqcxdo5ij83acHV5h53h X-Received: by 2002:a05:6402:270d:: with SMTP id y13mr9151056edd.66.1625884128045; Fri, 09 Jul 2021 19:28:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625884128; cv=none; d=google.com; s=arc-20160816; b=tPahladr1dtdW/eImnCRoVauk19RHFnNI5VS5OOadGgmJLfSUByhXDzcMcHUeIP1xi BRwDA7FfXvvYXC93cAjjvsTJWBFxPkazgVf/9aIpvFCd5NB2O8daue9q1Vak2v0aFhWG eTJwpylYwVNc6i3I6UV2pixk29Ot1rv+qDODFqZsE66jjAFZUC/KDqBSxIgTG1vCcUJs Z7N48JBbDceaMIkUDDBTgUrh0yKgU9C7VistMwRdZn4irBWSy3gRHcunJhrJRvaCPNCg SCbfmVEAUmE97IsAm44NBW/2Z48Xe4qPrMfWimjjRRaWywc++j6OGTH5FOX295YglKlm DEmQ== 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=Lr2L5yKaXSp2WQ5/A9tQ6qenq58+Wtxyy28Wf38UdYxZl7g2FSCiGpCfyVgBXxRplp K3XiepiwRjdc1p8fyDBz6yK50IMiEQurE+O/8hVeH6k7isppfqbgogozEA4BqPBUFOWW rx1uxKkJulpzMoNjWA8brPUADXSRuj+JWjwf8Pasrq8LNKt2Ab4w2JAk12pXpfaB0DA+ kXHvOAu25kmYzkpkZceMPwiyq+SXSI+gqJcviEO9b9TM9Rca90mRRbZoJi1vnEGiUsni cRIQkcmaAYRbGA72aZnsDcrEUTQFUnvxvkDwn/+gu3peg/wzYm95UbCagH5e1VhOdjkz koQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=FzwnGxBV; 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 dm22si3410247edb.248.2021.07.09.19.28.24; Fri, 09 Jul 2021 19:28:48 -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=FzwnGxBV; 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 S233600AbhGJC10 (ORCPT + 99 others); Fri, 9 Jul 2021 22:27:26 -0400 Received: from mail.kernel.org ([198.145.29.99]:42926 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233155AbhGJC0N (ORCPT ); Fri, 9 Jul 2021 22:26:13 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 8004F60BD3; Sat, 10 Jul 2021 02:23:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1625883802; bh=kkzpB9mHtqsTDc8yH38cr0ZSYOzrQ8stVA5/0TR9GAE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FzwnGxBVsShYlWQZBXRBMwbpGwMlBCgqQAooSHy3GHgOUznvD0QzRteLCLMpqXH4S P166+hITXQOe7ZXSdNyaQ3ePznMSAy//BipHl2e2tcjND2JWjHrYUu+SZTQTxW8H7T 3GU7kKzlonuwAuQdNopn5C0lkgktot4EX6SWeMjDgdJu34A9LElwyNZsxy4Ut/0JqP U+r4pIGWEvdJQ6AuZER4gd7QXjwlvr3PMVElZbRLKwV9BuMSh9zagqeV0IRtHaSo4k /SN3iLTYIOj9ZKGwprhNGMrT2NnQqGXm/611UHu3T6ISbITZSQmAxSnCbhMkKmxdGZ CkQVfI+Zb1wNg== 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.12 065/104] gpio: zynq: Check return value of irq_get_irq_data Date: Fri, 9 Jul 2021 22:21:17 -0400 Message-Id: <20210710022156.3168825-65-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210710022156.3168825-1-sashal@kernel.org> References: <20210710022156.3168825-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