Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp1225137pxb; Fri, 1 Apr 2022 07:52:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyBnCmTGBgA+1I3G1Q7OiVh8qA8JKU2Fh0UyjRtQduMteO0jV38NpRQdimLAC2y67zMHHKs X-Received: by 2002:a05:6402:43cc:b0:419:2486:6cd2 with SMTP id p12-20020a05640243cc00b0041924866cd2mr21449191edc.334.1648824745491; Fri, 01 Apr 2022 07:52:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648824745; cv=none; d=google.com; s=arc-20160816; b=W/AHeAzcsBDVEydWh/fXyoQnXYPxm5kbwExP9BgOgNu48is8NgA5KxLA1PNqewyQg4 cO69DYIifmqyYhSxR88QjxnRR1koBtactY1ILp7UAR/h6hLHApwfmQcYoKN0DczOPudg 9qA2v0YsuWDELFfxvrjAfOD05VDSwKKKwfBkz12DCnHA6JLpeJ7gp0RjMB5Ek+8xNJnF tarZkXpIJEzVBrVCaq3V42HTFcaUk8AejwtOpvUZSASiGveK+Nz1SSsYFIQcYVQDDv8L H4d4kkZCgN2LBoh+3jfwRFDgTwDM0zX5JoSIUXVUheutjqm3S50et5mXMpBSQZU0R5DA 1o1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=Fe7c3MBOX32L9almIm4Jeyjm70dlc1O9LRNKNNwwNP8=; b=ygy1C9P9JG4YgooeLD4YgqmGlYacEzdNVPhAe6ooCX5A7g/TLNN0ZoJXCQVife/HDB 2FZ21yLGS/JH9p7bt6kEiwi2eCX9tv+S/k5apsd2pKdV2LbV0kS9j8aDGB6EjyR6cIVM KOQ7mZKzfFPbNM9TTFo/AoQ7q4FBeun0y1W4utnDdHEtIQA2q//4TXyEQrGnYYwv3Syy ajlN35GQ828snI28SCyPMy0PbqIDmAyF63JX4JMzEoMXghdV5WY+/4v5Q1CFsj8t07yt 9pEiH9xDfvr2yy56IxnuKOCOy3lypMno07K93vAjgwz16PscppElE5zhTRLlXKcVLF+n eySw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=WnU2A92c; 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 f7-20020a50e087000000b00418c2b5bd2bsi1826314edl.13.2022.04.01.07.51.58; Fri, 01 Apr 2022 07:52:25 -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=WnU2A92c; 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 S240182AbiCaQpr (ORCPT + 99 others); Thu, 31 Mar 2022 12:45:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52590 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232097AbiCaQpq (ORCPT ); Thu, 31 Mar 2022 12:45:46 -0400 Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e3e3]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 398113587C for ; Thu, 31 Mar 2022 09:43:59 -0700 (PDT) Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: nfraprado) with ESMTPSA id 6D81A1F46FA3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1648745038; bh=94Cb7myupDPAqE8jKAnxrfz3kkcstfEKE3FYesYmFY8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=WnU2A92cVWBCeTzZ3DSb/z5w+q3NrzUc5piQzdi37Hb5+v9KBKh+sXdqJ1sUcdqho WMi6YxxFQoGmezY679nf23D/jPAdf6pDmLwP9/qX54M04YBcnJT2DE1czXcgTetqrR qR0zAeIKal/RVFnZXOUySsYImTjWOVkJ+tHMzhQe7CNH4PG0ibD/pgxGUQKDqcj0y7 HFgOOIYe4xaISAuHOJ/zSvvr6ATrpYKSqnBRA83UnK73YWAufPtMfOXLbbzWkvtcPr U7yUvhx8Q2AAp5+bFMh7rPOp0vrkKDEwfUHRExvr681eSN7ZVRaoAMYZxdHlv1wEQ3 rDZBC4axRjpCA== Date: Thu, 31 Mar 2022 12:43:53 -0400 From: =?utf-8?B?TsOtY29sYXMgRi4gUi4gQS4=?= Prado To: AngeloGioacchino Del Regno Cc: matthias.bgg@gmail.com, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 3/3] soc: mediatek: pwrap: Move and check return value of platform_get_irq() Message-ID: <20220331164353.unrxdeq756tj5et3@notapiano> References: <20220331075817.7122-1-angelogioacchino.delregno@collabora.com> <20220331075817.7122-4-angelogioacchino.delregno@collabora.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20220331075817.7122-4-angelogioacchino.delregno@collabora.com> 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 On Thu, Mar 31, 2022 at 09:58:17AM +0200, AngeloGioacchino Del Regno wrote: > 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); > -- > 2.35.1 >