From patchwork Sat May 20 08:05:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 96742 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp224889vqo; Sat, 20 May 2023 01:17:48 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7GukyeHULB+u7tgVoZQARiBKw6nlddvxYmRdq1XG7DGtlrcn7J/Gvs7a+iDp/UtwvACbSr X-Received: by 2002:a17:90a:cb84:b0:23f:1165:b49f with SMTP id a4-20020a17090acb8400b0023f1165b49fmr4862240pju.38.1684570667711; Sat, 20 May 2023 01:17:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684570667; cv=none; d=google.com; s=arc-20160816; b=tgnnTR08Wkub0cKYITXLXQVCdc/Clp/ms/WAKGjxu0NfqpEzRubVZp4Ps8N3KBtP2r LF+zv5Tn22HowNo/zTBIidCPjnUz7vGA3wWajFRc9rBFBHkcJS6lxIv9yzJgQfb7hRR+ 4AcXMYvnTg276edD6bHKcjQV3eTKzPIlr2N+HYYck/YmYmD2H3SXuLDicVTFfLrBaddo fuCucGxO8ddbat7C5fQGulO4y4IK4SB/1EP8/nlFf1Hs3egM/PMEHUbzeIPja4TksXlb DJCH7iSxPLlbPhfjQ5cyYI/VUzbX3NNM3h9uSYPIi5/VBgrGYQ8t7eAqz1Od0rdTnmo/ iAVQ== 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=FbFOTo7bbOqLCpse5mxCwFCHaJIvxu1hx1VMbc9WcyM=; b=Gog2KQd8AFz4HD9IPytuuu2rKE8KhlMElRpHQDUWaMHepXSMBJB7yP48LCvLMz2XBT 1ybC4wpYzLpUTH4/+jkMR7NAu53pVqA2FdGltyVZYFpG7eji3S3A57gDLVxTVRCM2/OW fDMA045+WT/ZAJedfrkBU006Fygdp7zPOfTdnKJpH1ES7Qf+G0qvNTkCzIXiO+9rwFmx hyHI8wE8FH0F9Sl9OfWNET7d9tViWN+WNA6tW7Z5aGCVhGgPvFmHfcOshoicoYrB9gL6 JZmjuvrDl7BNSQdDMarlGYRImr3KlnIpXbBTg6+ZE8QDrcliuv3W+6BfpWnS4ljtzf/G kPEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=qdMsTmyo; 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 g7-20020a17090a640700b0024e3b9ce927si3168288pjj.144.2023.05.20.01.17.36; Sat, 20 May 2023 01:17:47 -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=qdMsTmyo; 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 S230448AbjETIFP (ORCPT + 99 others); Sat, 20 May 2023 04:05:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55936 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229602AbjETIFN (ORCPT ); Sat, 20 May 2023 04:05:13 -0400 Received: from smtp.smtpout.orange.fr (smtp-24.smtpout.orange.fr [80.12.242.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 080C51AC for ; Sat, 20 May 2023 01:05:11 -0700 (PDT) Received: from pop-os.home ([86.243.2.178]) by smtp.orange.fr with ESMTPA id 0HaPqGwrCcjUo0HaPqpKsf; Sat, 20 May 2023 10:05:10 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1684569910; bh=FbFOTo7bbOqLCpse5mxCwFCHaJIvxu1hx1VMbc9WcyM=; h=From:To:Cc:Subject:Date; b=qdMsTmyonGN4tbdfAOPFZbo+BSHaTAIcTWJzN2NC6vs4YHHkOyEkNkY4XoDQg3JDs 3Jrwx6PbOR+8JAyxXuxaNTZ1CjT29AYgT4obgLcaCy6vpUXF7gaNRgJfKl31kOQ15z HE/fFAysTZ8iN5Bl1m79+DZO3hujEUMEIMyDLzEn75CZOJ9IgIlZTBS+boHFKzbR1T VYVeRs/bOElY2UI0AiCoth7u2WAmrxeAwMbDon39eAcHDngCKycr9bot5/JmsOEywx 7bStQcNkoXiMv6h5vkHwClIsk5rEJznzt37cALRrE1HgXWoOHKHItV9GU5zeQLtC07 +VcWt7T5QjsLA== X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Sat, 20 May 2023 10:05:10 +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] wl3501_cs: Fix an error handling path in wl3501_probe() Date: Sat, 20 May 2023 10:05:08 +0200 Message-Id: <7cc9c9316489b7d69b36aeb0edd3123538500b41.1684569865.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=ham 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?1766400372678016333?= X-GMAIL-MSGID: =?utf-8?q?1766400372678016333?= Should wl3501_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/wireless/legacy/wl3501_cs.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/drivers/net/wireless/legacy/wl3501_cs.c b/drivers/net/wireless/legacy/wl3501_cs.c index 7fb2f9513476..c45c4b7cbbaf 100644 --- a/drivers/net/wireless/legacy/wl3501_cs.c +++ b/drivers/net/wireless/legacy/wl3501_cs.c @@ -1862,6 +1862,7 @@ static int wl3501_probe(struct pcmcia_device *p_dev) { struct net_device *dev; struct wl3501_card *this; + int ret; /* The io structure describes IO port mapping */ p_dev->resource[0]->end = 16; @@ -1873,8 +1874,7 @@ static int wl3501_probe(struct pcmcia_device *p_dev) dev = alloc_etherdev(sizeof(struct wl3501_card)); if (!dev) - goto out_link; - + return -ENOMEM; dev->netdev_ops = &wl3501_netdev_ops; dev->watchdog_timeo = 5 * HZ; @@ -1887,9 +1887,15 @@ static int wl3501_probe(struct pcmcia_device *p_dev) netif_stop_queue(dev); p_dev->priv = dev; - return wl3501_config(p_dev); -out_link: - return -ENOMEM; + ret = wl3501_config(p_dev); + if (ret) + goto out_free_etherdev; + + return 0; + +out_free_etherdev: + free_netdev(dev); + return ret; } static int wl3501_config(struct pcmcia_device *link)