From patchwork Wed Dec 21 07:17:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 35282 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:e747:0:0:0:0:0 with SMTP id c7csp3385519wrn; Tue, 20 Dec 2022 23:30:39 -0800 (PST) X-Google-Smtp-Source: AMrXdXvLKjbkFnQh0bu6Y+aaGAtvo4s/95BlVc0ntXRe+unkzUxDbDyg1mETlLKWSRvqJDfCQt1C X-Received: by 2002:a62:6143:0:b0:577:3546:d7be with SMTP id v64-20020a626143000000b005773546d7bemr1363877pfb.30.1671607838864; Tue, 20 Dec 2022 23:30:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671607838; cv=none; d=google.com; s=arc-20160816; b=jxfRVTnqgTJYnH55itxka1ynprsuNUaBtI0F+Y3A0bXPatxOZFVVAT5Gryur/Qcvr+ 0Cc2SVCs07n5ynR+SlHbkaI+KZ/UJzHBYHDXiSPXaBUOgDoCrP0ThXwtXb5AUKrf3HUf uZcx4Vw/N+F7WzsVPwpSlt+zsmDwQAg6Oeqls56FJ/zf5VHUNsgvKdXkwuXwqausZOCa nY3iO5g6jxY/+5jOL+Ok/3ZT8faFE2cLuNfOYIoVRZiwUPT/jmS5rkp7bx1KuwPkpp8I jq8RCY4ItEEVY+gi8cmPbsxqfnAKLw73A9SqMZXNtGPDUUUA2s6qMf3cxMJRRaZFNpeH MqmA== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a20-20020aa794b4000000b00575deb1844asi14827504pfl.381.2022.12.20.23.30.26; Tue, 20 Dec 2022 23:30:38 -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 + 99 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_Ha=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 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1752807861343287376?= X-GMAIL-MSGID: =?utf-8?q?1752807861343287376?= 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; }