From nobody Wed Sep 17 08:53:58 2025 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 01D38C4167B for ; Wed, 21 Dec 2022 07:18:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231623AbiLUHSM (ORCPT ); Wed, 21 Dec 2022 02:18:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55648 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234435AbiLUHSC (ORCPT ); Wed, 21 Dec 2022 02:18:02 -0500 Received: from smtp.smtpout.orange.fr (smtp-24.smtpout.orange.fr [80.12.242.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 49A5C20BD3 for ; Tue, 20 Dec 2022 23:17:58 -0800 (PST) Received: from pop-os.home ([86.243.100.34]) by smtp.orange.fr with ESMTPA id 7tMQp7QGOyEjG7tMQpZrZE; Wed, 21 Dec 2022 08:17:57 +0100 X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Wed, 21 Dec 2022 08:17:57 +0100 X-ME-IP: 86.243.100.34 From: Christophe JAILLET To: Krzysztof Halasa , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , =?UTF-8?q?Krzysztof=20Ha=C5=82asa?= Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , netdev@vger.kernel.org Subject: [PATCH] ixp4xx_eth: Fix an error handling path in ixp4xx_eth_probe() Date: Wed, 21 Dec 2022 08:17:52 +0100 Message-Id: <3ab37c3934c99066a124f99e73c0fc077fcb69b4.1671607040.git.christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" If an error occurs after a successful ixp4xx_mdio_register() call, it should be undone by a corresponding ixp4xx_mdio_remove(). Add the missing call in the error handling path, as already done in the remove function. Fixes: 2098c18d6cf6 ("IXP4xx: Add PHYLIB support to Ethernet driver.") Signed-off-by: Christophe JAILLET --- drivers/net/ethernet/xscale/ixp4xx_eth.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/xscale/ixp4xx_eth.c b/drivers/net/etherne= t/xscale/ixp4xx_eth.c index 3b0c5f177447..007d68b385a5 100644 --- a/drivers/net/ethernet/xscale/ixp4xx_eth.c +++ b/drivers/net/ethernet/xscale/ixp4xx_eth.c @@ -1490,8 +1490,10 @@ static int ixp4xx_eth_probe(struct platform_device *= pdev) =20 netif_napi_add_weight(ndev, &port->napi, eth_poll, NAPI_WEIGHT); =20 - if (!(port->npe =3D npe_request(NPE_ID(port->id)))) - return -EIO; + if (!(port->npe =3D npe_request(NPE_ID(port->id)))) { + err =3D -EIO; + goto err_remove_mdio; + } =20 port->plat =3D plat; npe_port_tab[NPE_ID(port->id)] =3D port; @@ -1530,6 +1532,8 @@ static int ixp4xx_eth_probe(struct platform_device *p= dev) err_free_mem: npe_port_tab[NPE_ID(port->id)] =3D NULL; npe_release(port->npe); +err_remove_mdio: + ixp4xx_mdio_remove(); return err; } =20 --=20 2.34.1