Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp360934pxb; Thu, 31 Mar 2022 07:09:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwK15gHS8wZGmhFLpwFEXGyJC93b8JLfN4mhzNT/Sj1/O/IqNH7KauUDobjbm2vIc1AXNUI X-Received: by 2002:a17:907:7e93:b0:6e0:8c4f:b53 with SMTP id qb19-20020a1709077e9300b006e08c4f0b53mr5196931ejc.454.1648735746614; Thu, 31 Mar 2022 07:09:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648735746; cv=none; d=google.com; s=arc-20160816; b=BKRUa+BhlwFdN260uVMz9vZx6IKeCVK0dz24PQWo//NjRs/ZmklguxZhV2aHJafYB+ mzVrRCVvYy5YhZPgYqkph+oC/rN+VPIAL4ocf9udUHQtsNBcXmtdRFu1qnSFOFUweaEx uho114COkfhos+T5meTppJgAw0VG8UZHswid5xYimZrbnTQ+SW0CBBdlw+RuBxkj10Dl JPFwzs31C/kwklmovBmbAn8T9z2SagPrUR/OH8YgRTd8PG+oNnIv+E6yX5CW+LGc6ivO n/xFopTCeJw4rhkWAq8qtepYu3sBO+cJUF6Cus57KZfV6OC4+UmODZvJulhgPs86fQV6 IV6g== 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=v6SSdTo3JG2Fa1maTRiQ39nmY7/956ptuEzKVmLz2mo=; b=Iug1IXPRD/HPyTfAer2FJ+cbhxMYOWi5XtfxQnI9XaQOq4Pwk0FEo5jHvXoxgQx/O/ /zu92PTzFn83uHBqzD1w6qYdxivM46xRkFKZv3tUiy63S6jo4B6VcIIjpgAjimK697IP KudqMzzlNGJMyce8UmTJ9d7vIYzneOPMmP3yNCV6f417lRoaioam8usbaw9/hBXBd5Qc cFltrAVL9oql1xAqYl4oBLSRxZkemTU8PIJnBO2G1Tc0sWd7PNvhFlWhGktnQLlihO1L 6oBnKwLSzhJK62ILvcExyEI8JbeAZ4UqK5nPFjwv5yYqVQky5E7PatY3M06vCg09R12h uwig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=DWvTCqTd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n3-20020a05640205c300b00418ea5ad78bsi24508071edx.85.2022.03.31.07.08.39; Thu, 31 Mar 2022 07:09:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=DWvTCqTd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232470AbiCaIA2 (ORCPT + 99 others); Thu, 31 Mar 2022 04:00:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41842 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232414AbiCaIAP (ORCPT ); Thu, 31 Mar 2022 04:00:15 -0400 Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [46.235.227.227]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7ACBE13EAE for ; Thu, 31 Mar 2022 00:58:25 -0700 (PDT) Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: kholk11) with ESMTPSA id 97F091F463B2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1648713504; bh=bsvmRE+wqqh9TXXo7ZPObERdtNVFfcdK+ZOSlKfJ9jA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DWvTCqTdDWtQTNrH0p+UCgHL6kqIII8WyL5J74ksghMi3DhwDIjPzYPqefDGgu2FJ 0qqnYUossltngy97be+kWJ0DxR8q2ap5JLdB52rSJCBpL1zueIimVs9pa1U3u/ZNaw VshZl9F3blj/kCT0A88G+jeae2/fjPC305t+ap+bihc4SKIdvLUvXxt0GZ7Veb7RFQ Kh0rFMgZWEem0pvbBmQUz5wlmeAU93DQhX55aGzafYOhzwv2lU4vrWKoGwHm5kZNBV ClvzzhEV6pDUPVjS/Oc57KVjB+lt2jl0ixX55benTKVWKj3dOmPe2tJtihOebCjc3X cVApGRXjWs0tA== 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, AngeloGioacchino Del Regno Subject: [PATCH v2 3/3] soc: mediatek: pwrap: Move and check return value of platform_get_irq() Date: Thu, 31 Mar 2022 09:58:17 +0200 Message-Id: <20220331075817.7122-4-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220331075817.7122-1-angelogioacchino.delregno@collabora.com> References: <20220331075817.7122-1-angelogioacchino.delregno@collabora.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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 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); -- 2.35.1