From patchwork Sat May 20 08:13:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 96743 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp227214vqo; Sat, 20 May 2023 01:24:43 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7t1S6FBCtmynktzzpfqJc/XxAcCjfxpljgpivCjcipLu6qBlkHudiDsvSvacvpf4PjPCOd X-Received: by 2002:a05:6a20:728c:b0:ff:da37:ae9 with SMTP id o12-20020a056a20728c00b000ffda370ae9mr5262477pzk.53.1684571082816; Sat, 20 May 2023 01:24:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684571082; cv=none; d=google.com; s=arc-20160816; b=lBitW8CRzkGoOpxfkhfQANQft91piDl7EDLv3nS4Due5ycaaD3AFqWZcy6XJXp+Dx4 5RhYPPw2vRJlFSgBg+sKmci0CD2Ehm4wxlY7U/2A48ETGpGeu+MeR2Wq9Wa9i+cIrc4Y fop/6a5Q5w+A+c+botrO+d9X6P6KX5aGFm59hBbxMvqOzKz4uEMxTDZMrysG98Zt2sZm 1Ihqv1Dgs/cBZRW3yIAHP9xRZ0pEXRoasYDGq5cPs9JjuvZ03ySPDL5iAhAfOx30Yqdt wu7YYdtryKxhUHZ+FafNOwpaP+00Nupk5Vz9biVaV0QQikcjLah0OsnYhjLC6iE7EZMr 5EXQ== 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=vf7ubxBgJeC9eZsVETuMdnL0rrsNiehQfMJroM7eDOM=; b=ItMRd0PuX9RTMs2nbFQIBQ8h90iIckzeNwNyBT2SJ6kYSHNO4ix0urIPcMUxy2DHnj uBlFjewaYUScjnDoE3qs7LMXNsTvZikFoi6VBUqNMR1V3P7kD04v0HwNk9Fannm7A5Rx NPVH/wW6jLDrJBPyk6um71NcWCumS3jo2bUEGNy9Q1iettFXIqzZTwF36XiiQLlM8wPr WUPPQAMYrmDuL9Klc4/oMZd6BI/klZtO8YkXg6IjYYS9P5f0XvT4MeLtdPYqDfbyOAu8 nOZ378SXoKM69EwqTROE9bW47SVzorSdGgvZG5e3X/LRhYjO/rm1KWl5PAEyPPusbCXR KUxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=gxutPFjL; 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 m9-20020a654389000000b005309e5e80e4si1188230pgp.259.2023.05.20.01.24.27; Sat, 20 May 2023 01:24:42 -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=gxutPFjL; 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 S230039AbjETINf (ORCPT + 99 others); Sat, 20 May 2023 04:13:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57142 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230126AbjETINa (ORCPT ); Sat, 20 May 2023 04:13:30 -0400 Received: from smtp.smtpout.orange.fr (smtp-28.smtpout.orange.fr [80.12.242.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 467C51AC for ; Sat, 20 May 2023 01:13:28 -0700 (PDT) Received: from pop-os.home ([86.243.2.178]) by smtp.orange.fr with ESMTPA id 0HiPq3y35RkO40HiPqQ1BX; Sat, 20 May 2023 10:13:26 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1684570406; bh=vf7ubxBgJeC9eZsVETuMdnL0rrsNiehQfMJroM7eDOM=; h=From:To:Cc:Subject:Date; b=gxutPFjLO7XTx680cLQafn5WGGD6P7XoXLa+uMJHdSmFlz9Mj8b7YfLsAs+w/ptt/ Zr84INq3ghLFrj5mMcrQZxzIyk/pHibgUvxXcqIVG8LJQPD4sVFC6iWQNvVkhoADJw GkjbipR9aZ342ANcx0h8oOFhB137AJtkQ8Lr0PLjOveb9sYamvu9tw5wHHnSzbI3VI jbBu6ReGga6DzYlGuS/02lSeTANq2n5DltZN7qG1teJRbXHyiJIRN4ElLHkeJMv8pI bkTB4ReOxtPOKBBuJUmRF/sIVwD+l1KYfjxGPT7Gc/C4QYlNJ8kM4y1B+GheAAwWIc ynzP4tu0xhN8Q== X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Sat, 20 May 2023 10:13:26 +0200 X-ME-IP: 86.243.2.178 From: Christophe JAILLET To: Kalle Valo , Dominik Brodowski Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , linux-wireless@vger.kernel.org Subject: [PATCH wireless] ray_cs: Fix an error handling path in ray_probe() Date: Sat, 20 May 2023 10:13:22 +0200 Message-Id: <8c544d18084f8b37dd108e844f7e79e85ff708ff.1684570373.git.christophe.jaillet@wanadoo.fr> 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?1766400807936875790?= X-GMAIL-MSGID: =?utf-8?q?1766400807936875790?= Should ray_config() fail, some resources need to be released as already done in the remove function. While at it, remove a useless and erroneous comment. The probe is ray_probe(), not ray_attach(). Fixes: 15b99ac17295 ("[PATCH] pcmcia: add return value to _config() functions") Signed-off-by: Christophe JAILLET Reviewed-by: Simon Horman --- drivers/net/wireless/legacy/ray_cs.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/drivers/net/wireless/legacy/ray_cs.c b/drivers/net/wireless/legacy/ray_cs.c index 1f57a0055bbd..38782d4c4694 100644 --- a/drivers/net/wireless/legacy/ray_cs.c +++ b/drivers/net/wireless/legacy/ray_cs.c @@ -270,13 +270,14 @@ static int ray_probe(struct pcmcia_device *p_dev) { ray_dev_t *local; struct net_device *dev; + int ret; dev_dbg(&p_dev->dev, "ray_attach()\n"); /* Allocate space for private device-specific data */ dev = alloc_etherdev(sizeof(ray_dev_t)); if (!dev) - goto fail_alloc_dev; + return -ENOMEM; local = netdev_priv(dev); local->finder = p_dev; @@ -313,11 +314,16 @@ static int ray_probe(struct pcmcia_device *p_dev) timer_setup(&local->timer, NULL, 0); this_device = p_dev; - return ray_config(p_dev); + ret = ray_config(p_dev); + if (ret) + goto err_free_dev; + + return 0; -fail_alloc_dev: - return -ENOMEM; -} /* ray_attach */ +err_free_dev: + free_netdev(dev); + return ret; +} static void ray_detach(struct pcmcia_device *link) {