Received: by 2002:a05:6358:f14:b0:e5:3b68:ec04 with SMTP id b20csp5258329rwj; Tue, 20 Dec 2022 23:34:10 -0800 (PST) X-Google-Smtp-Source: AMrXdXvR0sW0fc9yhIauDAxF/tR+ISBre5MjdtF6EdqZiGZSi63WVJYYA2lFdd9gGE7D0ETpI/NP X-Received: by 2002:a17:903:214c:b0:191:1fbf:cd52 with SMTP id s12-20020a170903214c00b001911fbfcd52mr845880ple.48.1671608050452; Tue, 20 Dec 2022 23:34:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671608050; cv=none; d=google.com; s=arc-20160816; b=aDa4/+qr/ZApVmgfKMRIhmIWEV4P9wlPTwLp0nuqRbrdGcOZrC6vFKUDd2F/RjPMFx D45vzxGtv+S8qi89RgHoirOAFWdLWDGr4/ioCPw6aJn5Mqchb0bcAEknIkkOLl/pVWlC zkP3kLUPWuWn1Qwng2T+DTl4rKp7nxWrVeC/gAulbdZ8a2Q0R9Nt9bhSra/TSQhRa+mQ dSnB6vCTCqFddevrkJR2VYTnOp8CDB+/wp2zdlplM5KEcowrJbv59XPcKkm9R6ZYYBuA tsI9GANt4oPBOtaK2+3wPDdbKy3+vW6mITVN3T4byRg6zbkaVanKooQwqTDI3jLoeu7/ 5JLA== 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 :message-id:date:subject:cc:to:from; bh=yWPePZk71b3RnoRJu5WiSZVcpEfXwtzy+IvLxnWgRS0=; b=Ii+WM/CtJRFbUsD3XgM+CEKcK2IslRUm0SWj7Zmzsz2WdFHcG4pvh0SsLjn1871R+A SfLSX5aMse4hEPZz5oZIDRtbztwLO/geRJMpwNLtcU4We9yA4KO6Vmw17OH6bQjdMgsW w+o8vU/Y4kwVlC5iKea4XKI6Qh+jaJbOiR646LKS6MqDiWwzInfdY7NmKIwJLwOxFWhk Cr+06WgAWy2slKHyEsP2cf7gsUTUr0acdnwASPwXR0HVnSy4xYTbu03CeerXIFz2eXkp WMP+S2yYJf1x9Y7+XkVPL0EX8xMCY+oLvZe7Sq8Etwo2f5SgcL7mASFpWE5Zk6IwaYO/ xWaw== 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 p17-20020a170902f09100b001865c1ecf30si14364205pla.176.2022.12.20.23.34.01; Tue, 20 Dec 2022 23:34:10 -0800 (PST) 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 S234102AbiLUHSK (ORCPT + 70 others); Wed, 21 Dec 2022 02:18:10 -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: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=unavailable 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 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/ethernet/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) netif_napi_add_weight(ndev, &port->napi, eth_poll, NAPI_WEIGHT); - if (!(port->npe = npe_request(NPE_ID(port->id)))) - return -EIO; + if (!(port->npe = npe_request(NPE_ID(port->id)))) { + err = -EIO; + goto err_remove_mdio; + } port->plat = plat; npe_port_tab[NPE_ID(port->id)] = port; @@ -1530,6 +1532,8 @@ static int ixp4xx_eth_probe(struct platform_device *pdev) err_free_mem: npe_port_tab[NPE_ID(port->id)] = NULL; npe_release(port->npe); +err_remove_mdio: + ixp4xx_mdio_remove(); return err; } -- 2.34.1