From nobody Mon Feb 9 03:58:50 2026 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 D4F23C7EE26 for ; Sat, 20 May 2023 08:13:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230501AbjETINf (ORCPT ); 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 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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() functio= ns") 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/le= gacy/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; =20 dev_dbg(&p_dev->dev, "ray_attach()\n"); =20 /* Allocate space for private device-specific data */ dev =3D alloc_etherdev(sizeof(ray_dev_t)); if (!dev) - goto fail_alloc_dev; + return -ENOMEM; =20 local =3D netdev_priv(dev); local->finder =3D p_dev; @@ -313,11 +314,16 @@ static int ray_probe(struct pcmcia_device *p_dev) timer_setup(&local->timer, NULL, 0); =20 this_device =3D p_dev; - return ray_config(p_dev); + ret =3D ray_config(p_dev); + if (ret) + goto err_free_dev; + + return 0; =20 -fail_alloc_dev: - return -ENOMEM; -} /* ray_attach */ +err_free_dev: + free_netdev(dev); + return ret; +} =20 static void ray_detach(struct pcmcia_device *link) { --=20 2.34.1