From nobody Sun Feb 8 22:43:27 2026 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 44AC0C001DF for ; Mon, 31 Jul 2023 07:40:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231748AbjGaHkE (ORCPT ); Mon, 31 Jul 2023 03:40:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48030 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231704AbjGaHjr (ORCPT ); Mon, 31 Jul 2023 03:39:47 -0400 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5262210C1; Mon, 31 Jul 2023 00:39:38 -0700 (PDT) Received: from kwepemi500008.china.huawei.com (unknown [172.30.72.54]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4RDqnM1YFszLnyZ; Mon, 31 Jul 2023 15:36:55 +0800 (CST) Received: from huawei.com (10.90.53.73) by kwepemi500008.china.huawei.com (7.221.188.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Mon, 31 Jul 2023 15:39:35 +0800 From: Ruan Jinjie To: , , , , , , , CC: Subject: [PATCH -next] net: hisilicon: fix the return value handle and remove redundant netdev_err() for platform_get_irq() Date: Mon, 31 Jul 2023 15:38:58 +0800 Message-ID: <20230731073858.3633193-1-ruanjinjie@huawei.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.90.53.73] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To kwepemi500008.china.huawei.com (7.221.188.139) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" There is no possible for platform_get_irq() to return 0 and the return value of platform_get_irq() is more sensible to show the error reason. And there is no need to call the netdev_err() function directly to print a custom message when handling an error from platform_get_irq() function as it is going to display an appropriate error message in case of a failure. Signed-off-by: Ruan Jinjie Reviewed-by: Dan Carpenter Reviewed-by: Jesse Brandeburg --- drivers/net/ethernet/hisilicon/hip04_eth.c | 4 ++-- drivers/net/ethernet/hisilicon/hisi_femac.c | 4 ++-- drivers/net/ethernet/hisilicon/hix5hd2_gmac.c | 5 ++--- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/net/ethernet/hisilicon/hip04_eth.c b/drivers/net/ether= net/hisilicon/hip04_eth.c index 50c3f5d6611f..ecf92a5d56bb 100644 --- a/drivers/net/ethernet/hisilicon/hip04_eth.c +++ b/drivers/net/ethernet/hisilicon/hip04_eth.c @@ -960,8 +960,8 @@ static int hip04_mac_probe(struct platform_device *pdev) } =20 irq =3D platform_get_irq(pdev, 0); - if (irq <=3D 0) { - ret =3D -EINVAL; + if (irq < 0) { + ret =3D irq; goto init_fail; } =20 diff --git a/drivers/net/ethernet/hisilicon/hisi_femac.c b/drivers/net/ethe= rnet/hisilicon/hisi_femac.c index ce2571c16e43..cb7b0293fe85 100644 --- a/drivers/net/ethernet/hisilicon/hisi_femac.c +++ b/drivers/net/ethernet/hisilicon/hisi_femac.c @@ -862,8 +862,8 @@ static int hisi_femac_drv_probe(struct platform_device = *pdev) goto out_disconnect_phy; =20 ndev->irq =3D platform_get_irq(pdev, 0); - if (ndev->irq <=3D 0) { - ret =3D -ENODEV; + if (ndev->irq < 0) { + ret =3D ndev->irq; goto out_disconnect_phy; } =20 diff --git a/drivers/net/ethernet/hisilicon/hix5hd2_gmac.c b/drivers/net/et= hernet/hisilicon/hix5hd2_gmac.c index f867e9531117..26d22bb04b87 100644 --- a/drivers/net/ethernet/hisilicon/hix5hd2_gmac.c +++ b/drivers/net/ethernet/hisilicon/hix5hd2_gmac.c @@ -1206,9 +1206,8 @@ static int hix5hd2_dev_probe(struct platform_device *= pdev) } =20 ndev->irq =3D platform_get_irq(pdev, 0); - if (ndev->irq <=3D 0) { - netdev_err(ndev, "No irq resource\n"); - ret =3D -EINVAL; + if (ndev->irq < 0) { + ret =3D ndev->irq; goto out_phy_node; } =20 --=20 2.34.1