From patchwork Tue Mar 29 15:22:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AngeloGioacchino Del Regno X-Patchwork-Id: 12794958 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 92E33C433F5 for ; Tue, 29 Mar 2022 15:24:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Mf8kVq3GaaRKsJGtnLVKbnJ0uY933uWephp+EGvFxjo=; b=qiARJ3u3XmC0Cn 98IU7m90R25H6nbKzOW2A5RZMRGLCPOVOcEP1iLZo7LhSOoh2/J4O23M7cLuKiTb8G6Qr3PPtWBD/ 38FQABYbdS2UBEF4/F+vFQnhzVale6PYo2d/VUy120vtHYJv7ni8G7HoBa1O1J/eEfOe07izXEiE1 0w7kp2J9+z+m0y269Nt03A4JIfpFvn7ZNFCrnTyozszwtVliGWEj+7Miz/Dd1hBxoHnPQlF1nKLH6 IU2QmABsFnUUUBkxr5fGiB/rsMrxPG0ejsyatDZlWTPkdbaFDyz9cdBY0hrDYmczAvggQg9M3MyQl a65CvfFsgagHxT3lQHxw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nZDgl-00Cdxz-CQ; Tue, 29 Mar 2022 15:23:19 +0000 Received: from bhuna.collabora.co.uk ([46.235.227.227]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nZDgN-00Cdrd-3x; Tue, 29 Mar 2022 15:22:56 +0000 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: kholk11) with ESMTPSA id 1BDE81F426BF DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1648567373; bh=1LY9QgdlXhZN0ZJtVH71yykyQQc/7fSR67bBdC4ee0M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MPLrlly/RZOVYUL7J2NURkqWyGjULbYbq3aDWnd/zGhoI8DhCs7KH50NE3jn/FGy5 oGXEDgF9dWYCE8RXL3Ma0op0lw+FokADB/aokLce9LewUlsoYT1/qNmEbG9pnwMQxc 7yP0G8kL3vP/rhYEFPD753GhWtASP4c31xgylS0hvfatUJs1HiUw2N2X1P1a+hl5Tu XoAOoVdAY9neSQxUNR+b4qfZmMYWV+Z2li45JEMNoTU1IU6HGlYwJBoo56/EETH2VB gFHS6rtTu3XE1RLMDCwLVPKtSZii4k+M8yxxU8wba6zDoMqXodTTHjO0m4EecSvHrH DKRT9Pw0Wg32A== From: AngeloGioacchino Del Regno To: matthias.bgg@gmail.com Cc: nfraprado@collabora.com, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org, AngeloGioacchino Del Regno Subject: [PATCH 3/3] soc: mediatek: pwrap: Move and check return value of platform_get_irq() Date: Tue, 29 Mar 2022 17:22:45 +0200 Message-Id: <20220329152245.124341-3-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220329152245.124341-1-angelogioacchino.delregno@collabora.com> References: <20220329152245.124341-1-angelogioacchino.delregno@collabora.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220329_082255_314084_2DC00283 X-CRM114-Status: GOOD ( 14.39 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Move the call to platform_get_irq() earlier in the probe function and check for its return value: if no interrupt is specified, it wouldn't make sense to try to call devm_request_irq() so, in that case, we can simply return early. Moving the platform_get_irq() call also makes it possible to use one less goto, as clocks aren't required at that stage. Signed-off-by: AngeloGioacchino Del Regno --- drivers/soc/mediatek/mtk-pmic-wrap.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/soc/mediatek/mtk-pmic-wrap.c b/drivers/soc/mediatek/mtk-pmic-wrap.c index 755b8d00faa9..72d82fe2e230 100644 --- a/drivers/soc/mediatek/mtk-pmic-wrap.c +++ b/drivers/soc/mediatek/mtk-pmic-wrap.c @@ -2204,6 +2204,10 @@ static int pwrap_probe(struct platform_device *pdev) if (!wrp) return -ENOMEM; + irq = platform_get_irq(pdev, 0); + if (irq < 0) + return irq; + platform_set_drvdata(pdev, wrp); wrp->master = of_device_get_match_data(&pdev->dev); @@ -2316,7 +2320,6 @@ static int pwrap_probe(struct platform_device *pdev) if (HAS_CAP(wrp->master->caps, PWRAP_CAP_INT1_EN)) pwrap_writel(wrp, wrp->master->int1_en_all, PWRAP_INT1_EN); - irq = platform_get_irq(pdev, 0); ret = devm_request_irq(wrp->dev, irq, pwrap_interrupt, IRQF_TRIGGER_HIGH, "mt-pmic-pwrap", wrp);