From patchwork Sat Nov 18 08:50:48 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arvind Yadav X-Patchwork-Id: 10064579 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 7CEBB6023A for ; Sat, 18 Nov 2017 09:03:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 66F872A53A for ; Sat, 18 Nov 2017 09:03:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 494112A5AE; Sat, 18 Nov 2017 09:03:56 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, DKIM_VALID, FREEMAIL_FROM, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id CE1262A53A for ; Sat, 18 Nov 2017 09:03:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=PmsNDjDcoPQ21+mpVT3zKVXHlDSEXzMQLqsA0CtZ52A=; b=JimSIWhzXpNTrWW3AqjxNqnYyI 3EXPMJ9+oU072LnbqVW7dw2e/9mIh8ehBi1hkUZLMLVlF43x7l68XoECW0mA4bcNOs6YMr+jzL2+C 5NwZpvooRP5JvevqDYlUpUqMh079IGGvn19jiWsMPcWdtSskTdfYpHpaP2FtKVtWoD7m/VtGSmTpu /j36916P0BPN/iIFOxiizR7RUNxx4/phqUspb7Va9Fmaa7C+6/84OqIfmGze8XuVB8D5dd7POzBPI XbwqdWFdllyowVd24wqghLYmlYbkyBlLNsHKAZcNjUDX5NIb5oLTrUee1iCqGO++JR5/QGJYEBQpy pNSCFMng==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1eFz2Y-0001RJ-Fq; Sat, 18 Nov 2017 09:03:54 +0000 Received: from mail-pg0-x244.google.com ([2607:f8b0:400e:c05::244]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1eFyqS-0002F2-7g for linux-arm-kernel@lists.infradead.org; Sat, 18 Nov 2017 08:51:28 +0000 Received: by mail-pg0-x244.google.com with SMTP id s11so3705717pgc.5 for ; Sat, 18 Nov 2017 00:51:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=ACvuZp6sdl84EC2sfvlQzz5OIbXPZ3MXzOf6LxfHpB0=; b=OTx0RHkrDUJgZK4etl4KNnIWTuBMb5S6SpWbbvUEG7M/cAG4xkPEzgjLrWWkCdJFNE oU5q2ZMnfVVqzwgrAPvD/+F05KO7jIqhjRFUzxkuAPluvt67vDdoMkmDYtR6nNw8+g1R ZUotOk8zoGBpT4H5118mjClrRA4NF3qnlB4fyC7HmfucOKrPMdiY+LisG27YyKU0sm9m j/juvya+HQOpmRAEvxgNBs8BsyAY5/c2Ckw8J/1KpQyzRy6FdJW0dyt2XFBPDOEf1mQF VDQNy2QAGCyO3qZlyYipnlmPGLA2IdiWFhX1PrLugQXzjv+bc9EE1KS1gFt/utlws9/j F6rg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=ACvuZp6sdl84EC2sfvlQzz5OIbXPZ3MXzOf6LxfHpB0=; b=Lmgve6rTnoh5WLZaD6gXrB3KWQt5N8uby87jqjwSHnCdUmM+y2P/UclTbTugmMcQCE o0t2BTA4nDTakOuE/CqIqLrcpTFR8cws4TIL5439HRJex+X6uAzeVJ0t4kmuCXMBeXB0 tAEJvRgyTMhJdoUDT8VI+/Hwf1yPDHAbNbqppuTawkmw8yy5bNrY3ZAtOHdCdu85U3gH P1AS+QNsywhaB0DpPn709uOLiYzvZpmL1zVdh1c3IbMsmt+DHzzZakXilCJV7fcuu4pV hIuYGOGegmC1wrpkSycAsXqVOOVhUMRvug1oh5ZEqXMl7DqCyiCA/r1bMyeps/SbH5/s v8xA== X-Gm-Message-State: AJaThX6DhHkVYXHWx3XoA1iXy/VHcGeYOJMoOCO5C4RIu+0Y5cfsSI76 mygn+/cPRepM4uv361mvVpc= X-Google-Smtp-Source: AGs4zMaPPevGOCJpn4UTr8a5bPstvB771QFpkVMggZ4Po1kkFwtDqxSsLMRKiYgMsyKYjJjyan8s3A== X-Received: by 10.101.74.8 with SMTP id s8mr7503706pgq.259.1510995063780; Sat, 18 Nov 2017 00:51:03 -0800 (PST) Received: from localhost.localdomain ([103.16.68.147]) by smtp.gmail.com with ESMTPSA id 3sm11847104pfo.17.2017.11.18.00.51.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 18 Nov 2017 00:51:03 -0800 (PST) From: Arvind Yadav To: lee.jones@linaro.org, maxime.ripard@free-electrons.com, wens@csie.org, linux@armlinux.org.uk Subject: [PATCH 2/3 v2] mfd: intel-lpss: Handle return value of platform_get_irq Date: Sat, 18 Nov 2017 14:20:48 +0530 Message-Id: <4123c03394df1d0a1349a9eeebf74fcf760c79d5.1510994295.git.arvind.yadav.cs@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <4f12b680d2f0d7554e6a1812f15037185a5a9a2a.1510994294.git.arvind.yadav.cs@gmail.com> References: <4f12b680d2f0d7554e6a1812f15037185a5a9a2a.1510994294.git.arvind.yadav.cs@gmail.com> In-Reply-To: <4f12b680d2f0d7554e6a1812f15037185a5a9a2a.1510994294.git.arvind.yadav.cs@gmail.com> References: <4f12b680d2f0d7554e6a1812f15037185a5a9a2a.1510994294.git.arvind.yadav.cs@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171118_005124_643684_B9D32B44 X-CRM114-Status: UNSURE ( 8.75 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP platform_get_irq() can fail here and we must check its return value. Signed-off-by: Arvind Yadav --- changes in v2 : Add failure case '<= 0' instead of '< 0'. If IRQ0 is not valid. drivers/mfd/intel-lpss-acpi.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/mfd/intel-lpss-acpi.c b/drivers/mfd/intel-lpss-acpi.c index 7911b0a..cb84de5 100644 --- a/drivers/mfd/intel-lpss-acpi.c +++ b/drivers/mfd/intel-lpss-acpi.c @@ -92,6 +92,8 @@ static int intel_lpss_acpi_probe(struct platform_device *pdev) info->mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); info->irq = platform_get_irq(pdev, 0); + if (!info->mem || info->irq <= 0) + return -ENOMEM; pm_runtime_set_active(&pdev->dev); pm_runtime_enable(&pdev->dev);