From patchwork Sat May 20 09:48:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 96746 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp260851vqo; Sat, 20 May 2023 02:53:27 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4BEs17iUQvmQSW94yEHU/HEK76DhyRlL87w4YXLkCV0ixOcHoXdnWkVRPGQUDoWAT88nxS X-Received: by 2002:a05:6a00:2288:b0:643:aa8d:8cd7 with SMTP id f8-20020a056a00228800b00643aa8d8cd7mr7511079pfe.32.1684576407472; Sat, 20 May 2023 02:53:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684576407; cv=none; d=google.com; s=arc-20160816; b=FsBXUUkpYjz/9BpVFTygz2iyJiPDd6+BokV/m75pVWmmVQ2KQghQ5fwR80Ebl398sk 8ROe/APTbKSzbT93iX3e7xf/WAqyZmc3PlPQarBsuwflj2ze1b7ZJxceDIgd9mtpQkDt iTzWJ01pimuHbvf6/b8ix0imesBsRY2NJuCNBBT3a0Dn8UwfvSMM8/IKX9JDm8mNRs+p zyPJxbjCYCCe6CcMwPmts6rYcI8AcQRKolSQci84T57/xG/deKp2If4haAWHqVr7mQ52 C4ry1WSrkBeHx5EP2VZODzeeJ6t3owfYrpLkdZO2+64PP407hr+auDadCoq5iqVChMo+ jt7g== 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:dkim-signature; bh=PFeiTJVHke4bEGuoYNcOkxZOFogPE/KWv3YrygEuprE=; b=r7DkCf9ZSVE1MPdmNIevxTCkPAhevI3zFEe+OsOJCk7MN7ONxyEgHgoZeAkPVHWq8A Eu40DEvoZJjOfFFBUx+b2oCXlOco4MtH8bDmSp5kHrxCwmUYphU0mubMif9XiHsiRVTl mDu7ijVh+Xxehpg2eofXd6Vs4DNiP6hmPlbbZyLZQMShCAVfulrKVevVwgWhKpBPao13 pssBc1uJno+B8VEGUu9+6do0FzguXrNX6YvNQFnwcgQu85GQx+Iu5itX8k9lHUQcrwiv GVzX0PteazteKcuUqgmB4LWfgqd27dMA765wb+OjPmQk6TypESa7Bt05s4GEZbketu6i 856A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=ZZmnYIxh; 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 z13-20020aa7948d000000b0064d3e917a90si1292697pfk.180.2023.05.20.02.53.15; Sat, 20 May 2023 02:53:27 -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; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=ZZmnYIxh; 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 S231417AbjETJtE (ORCPT + 99 others); Sat, 20 May 2023 05:49:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47392 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229946AbjETJtD (ORCPT ); Sat, 20 May 2023 05:49:03 -0400 Received: from smtp.smtpout.orange.fr (smtp-25.smtpout.orange.fr [80.12.242.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 78773E42 for ; Sat, 20 May 2023 02:49:01 -0700 (PDT) Received: from pop-os.home ([86.243.2.178]) by smtp.orange.fr with ESMTPA id 0JCrqmyLhJVoz0JCrqxvws; Sat, 20 May 2023 11:48:59 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1684576139; bh=PFeiTJVHke4bEGuoYNcOkxZOFogPE/KWv3YrygEuprE=; h=From:To:Cc:Subject:Date; b=ZZmnYIxhy2r+fBlx5gImUrUjp5VJ9heiJfdHbrg1D9u+rGIDidIrJ35WOrhesnvkQ /zVnMJfVC8VgwYqsmlgG8Gq62luUVWWYXiUx+4mGp3YoZdFqxDvbRFtA4FfYU4nIfs UODreIOmfBaKoj71ZRxnIUVzdHzBpU/rzx9shW4BdVf5O6PmM8nHzKYw29XSpNXUFJ uuYmg62rpeDQ4VHEocHUk0njr5LJfzB+VFh6FMaiDDUQrtOOff1sCKLVrJNCHnWq// C1ad6e4+An+BM2jVUL6gMeJL+0o8tDzJhtCWvrrs5iFW6XFzMEXSbld+Z+OsZ9+tYt eM7uYsJZ6D9hg== X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Sat, 20 May 2023 11:48:59 +0200 X-ME-IP: 86.243.2.178 From: Christophe JAILLET To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Dominik Brodowski Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , netdev@vger.kernel.org Subject: [PATCH net] 3c589_cs: Fix an error handling path in tc589_probe() Date: Sat, 20 May 2023 11:48:55 +0200 Message-Id: X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE 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?1766406390639850500?= X-GMAIL-MSGID: =?utf-8?q?1766406390639850500?= Should tc589_config() fail, some resources need to be released as already done in the remove function. Fixes: 15b99ac17295 ("[PATCH] pcmcia: add return value to _config() functions") Signed-off-by: Christophe JAILLET Reviewed-by: Simon Horman --- drivers/net/ethernet/3com/3c589_cs.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/3com/3c589_cs.c b/drivers/net/ethernet/3com/3c589_cs.c index 82f94b1635bf..5267e9dcd87e 100644 --- a/drivers/net/ethernet/3com/3c589_cs.c +++ b/drivers/net/ethernet/3com/3c589_cs.c @@ -195,6 +195,7 @@ static int tc589_probe(struct pcmcia_device *link) { struct el3_private *lp; struct net_device *dev; + int ret; dev_dbg(&link->dev, "3c589_attach()\n"); @@ -218,7 +219,15 @@ static int tc589_probe(struct pcmcia_device *link) dev->ethtool_ops = &netdev_ethtool_ops; - return tc589_config(link); + ret = tc589_config(link); + if (ret) + goto err_free_netdev; + + return 0; + +err_free_netdev: + free_netdev(dev); + return ret; } static void tc589_detach(struct pcmcia_device *link)