Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp1276542rwb; Thu, 11 Aug 2022 20:23:38 -0700 (PDT) X-Google-Smtp-Source: AA6agR4Z145+vAte9qMwfKVtT5gHLWxvMBBfR3T0r5zxBWLwIfuTR2zNropkBXViRg8i8qRUrEc9 X-Received: by 2002:a05:6a00:2402:b0:52c:81cf:8df8 with SMTP id z2-20020a056a00240200b0052c81cf8df8mr2044197pfh.60.1660274617886; Thu, 11 Aug 2022 20:23:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660274617; cv=none; d=google.com; s=arc-20160816; b=cgsdy85NHO81VXBz5afFvX124aG+Hqs9vwxO1CSKbCHe7S7U/VS0OxfUQqSLjH+BYf MiCdEnICSqcKUQzJAz4SUtxuwXuMSqJNdwoZwgRNH1knVJePU5fjnZQPzzz1Fb1QJgaM /c8X62lY/gXNTkjazt9i+oSME9SdeLV1714/ItGhJ2ZLbP791JjNHGIfa9coNNnyJbBm r6ZSSXlmtnVau9NKVtPAUNsJDJq09LTbRECaL9XFqH87qxojD7Hs0BzW0YP0+uI0o0XU tQb/YgZ/12SQakhqHS3FAVJ/kyLvjQM61TQjzr8rjTtXrI8rb7o7KB2n0C0/IigrfsHy EsiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from; bh=w/1pGq9WoLn7Rl2NiNEbX4ytNd9MgHuc3aJAh/NXJFY=; b=r1WNdYYNg/prKq5x09vFszBDplsCDifBg5mYxR4+aDXkcDOuRkl5HfNP6eglcFEvno CAdbhmTy4UuPgZQgh48Oe03S0dZ7V1eznkuGWB//tbP8b7/BgnRGinUp00Bq0wbbOEEd 9nVjfsPUujwJirc1lOrS7YvpwTUq06ejsXP8PzCqRKHqopJQ0r+Rkxy1tdq0PiANMAyO nZ0akDvXfWUUGi12GMY5GCJ5XVgjpB38AvKuUqRapzX1pvXOZH9++ZHO45oDM4fWgwJq CRAYhVrlTdmK/1zXneeJ7LegKCHC7jLinjHFI0bis8o7jrUgR0j/2hqElMrHZKFfkDSi XAfg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bc2-20020a170902930200b0016ecd3d0519si912362plb.593.2022.08.11.20.23.23; Thu, 11 Aug 2022 20:23:37 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236759AbiHLDLQ (ORCPT + 99 others); Thu, 11 Aug 2022 23:11:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41884 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231283AbiHLDLL (ORCPT ); Thu, 11 Aug 2022 23:11:11 -0400 Received: from mail.nfschina.com (unknown [IPv6:2400:dd01:100f:2:72e2:84ff:fe10:5f45]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 12AB199245; Thu, 11 Aug 2022 20:11:09 -0700 (PDT) Received: from localhost (unknown [127.0.0.1]) by mail.nfschina.com (Postfix) with ESMTP id 3A4231E80D77; Fri, 12 Aug 2022 11:09:00 +0800 (CST) X-Virus-Scanned: amavisd-new at test.com Received: from mail.nfschina.com ([127.0.0.1]) by localhost (mail.nfschina.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id jdzEI2JOMAJ2; Fri, 12 Aug 2022 11:08:57 +0800 (CST) Received: from localhost.localdomain (unknown [180.167.10.98]) (Authenticated sender: liqiong@nfschina.com) by mail.nfschina.com (Postfix) with ESMTPA id B80A41E80D0F; Fri, 12 Aug 2022 11:08:56 +0800 (CST) From: Li Qiong To: Horatiu Vultur , UNGLinuxDriver@microchip.com, "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, yuzhe@nfschina.com, renyu@nfschina.com, jiaming@nfschina.com, kernel-janitors@vger.kernel.org, Li Qiong Subject: [PATCH] net: lan966x: fix checking for return value of platform_get_irq_byname() Date: Fri, 12 Aug 2022 11:09:54 +0800 Message-Id: <20220812030954.24050-1-liqiong@nfschina.com> X-Mailer: git-send-email 2.11.0 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,RDNS_NONE, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 The platform_get_irq_byname() returns non-zero IRQ number or negative error number. "if (irq)" always true, chang it to "if (irq > 0)" Signed-off-by: Li Qiong --- drivers/net/ethernet/microchip/lan966x/lan966x_main.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/microchip/lan966x/lan966x_main.c b/drivers/net/ethernet/microchip/lan966x/lan966x_main.c index 1d6e3b641b2e..d928b75f3780 100644 --- a/drivers/net/ethernet/microchip/lan966x/lan966x_main.c +++ b/drivers/net/ethernet/microchip/lan966x/lan966x_main.c @@ -710,7 +710,7 @@ static void lan966x_cleanup_ports(struct lan966x *lan966x) disable_irq(lan966x->xtr_irq); lan966x->xtr_irq = -ENXIO; - if (lan966x->ana_irq) { + if (lan966x->ana_irq > 0) { disable_irq(lan966x->ana_irq); lan966x->ana_irq = -ENXIO; } @@ -718,10 +718,10 @@ static void lan966x_cleanup_ports(struct lan966x *lan966x) if (lan966x->fdma) devm_free_irq(lan966x->dev, lan966x->fdma_irq, lan966x); - if (lan966x->ptp_irq) + if (lan966x->ptp_irq > 0) devm_free_irq(lan966x->dev, lan966x->ptp_irq, lan966x); - if (lan966x->ptp_ext_irq) + if (lan966x->ptp_ext_irq > 0) devm_free_irq(lan966x->dev, lan966x->ptp_ext_irq, lan966x); } @@ -1049,7 +1049,7 @@ static int lan966x_probe(struct platform_device *pdev) } lan966x->ana_irq = platform_get_irq_byname(pdev, "ana"); - if (lan966x->ana_irq) { + if (lan966x->ana_irq > 0) { err = devm_request_threaded_irq(&pdev->dev, lan966x->ana_irq, NULL, lan966x_ana_irq_handler, IRQF_ONESHOT, "ana irq", lan966x); -- 2.11.0