From patchwork Mon May 16 12:46:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: AngeloGioacchino Del Regno X-Patchwork-Id: 12850748 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 7BADBC433EF for ; Mon, 16 May 2022 12:47:37 +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=4KF6ACgKcjXA9IU8I6rmd3xezOhHYCX0qCWWEs4Xci8=; b=nYmGsCRnYA7BM9 VLwN5bKwYY0tyc+H0Pmrun/paPx7f81SIi1XVlawtxqOk+C9EhsaOeR//kBOJudWG2DwPo17nBaOV t+/UUp6G13hBfYX77KPrB3+V3FPK34ce7zEHVZ3TrpnmzitR0zAIuPMzR+mSqCLL+VmTYDEKxT28c HcdBKJGPa8D3JmXqV79KfCJxpy5637uCa0SkMnlJ9VJeCMMKJc1ybh0TlQOsnjS6vK5KQmk+RFQ2v V7UbTTCi31ujf8YUW7hTbzAJwXxePRgwxp85cabLbIgFc6/nej7qKOEBZaxmaz1jhM+PTof2RTNgP m5UmUFf2gjSeyUxlT5oQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nqa8K-007gtZ-TL; Mon, 16 May 2022 12:47:32 +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 1nqa7y-007gl6-FF; Mon, 16 May 2022 12:47:13 +0000 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: kholk11) with ESMTPSA id 1A38C1F42F4F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1652705226; bh=WLVrWccIwGrbjarjl1t+zyyFEO23qLIaLUG4z1ooZTI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=N/45Ky2Bk30/JnJ2vUjgK4WzlqnlOVSDfJtgeEGMSTjv/55mkln5smG4KTTHWfhgu pWQBtCB85Rg2nO7BbzQSDWMKy2dZc8eDFdsh+s9jzqW9dpzCRc5PGNOjpn0Wfy6Aa/ P0LynZiL1WiX9+H2jxRxFbXoM/mZYyCqtN6XJLFfKFYv+tG5fMM+K5drluDtB7uGAb EmkAvAfwvsO6nnj7kzJAuS+fwQyGH5bVcEficPMC5jSKpSsGB4KBaa4UiQfNd6nssV ghs/KknjjvMXkmRDnIzRkURSMUfHszGoKsi9q/BuEWNOhFLwXHmLVCQmu+kxT9zDqD 4VSrgGl3G43kA== From: AngeloGioacchino Del Regno To: matthias.bgg@gmail.com Cc: linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org, nfraprado@collabora.com, rex-bc.chen@mediatek.com, zhiyong.tao@mediatek.com, AngeloGioacchino Del Regno Subject: [PATCH v3 3/5] soc: mediatek: pwrap: Move and check return value of platform_get_irq() Date: Mon, 16 May 2022 14:46:57 +0200 Message-Id: <20220516124659.69484-4-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220516124659.69484-1-angelogioacchino.delregno@collabora.com> References: <20220516124659.69484-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-20220516_054710_810714_83C5CB6E X-CRM114-Status: GOOD ( 14.74 ) X-BeenThere: linux-mediatek@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-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=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 Reviewed-by: NĂ­colas F. R. A. Prado Tested-by: NĂ­colas F. R. A. Prado --- 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 852514366f1f..332cbcabc299 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);