* [PATCH wireless] wl3501_cs: Fix an error handling path in wl3501_probe()
@ 2023-05-20 8:05 Christophe JAILLET
2023-05-24 10:26 ` Simon Horman
2023-05-25 16:16 ` [wireless] wifi: " Kalle Valo
0 siblings, 2 replies; 3+ messages in thread
From: Christophe JAILLET @ 2023-05-20 8:05 UTC (permalink / raw)
To: Kalle Valo, Dominik Brodowski
Cc: linux-kernel, kernel-janitors, Christophe JAILLET, linux-wireless
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 <christophe.jaillet@wanadoo.fr>
---
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)
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH wireless] wl3501_cs: Fix an error handling path in wl3501_probe()
2023-05-20 8:05 [PATCH wireless] wl3501_cs: Fix an error handling path in wl3501_probe() Christophe JAILLET
@ 2023-05-24 10:26 ` Simon Horman
2023-05-25 16:16 ` [wireless] wifi: " Kalle Valo
1 sibling, 0 replies; 3+ messages in thread
From: Simon Horman @ 2023-05-24 10:26 UTC (permalink / raw)
To: Christophe JAILLET
Cc: Kalle Valo, Dominik Brodowski, linux-kernel, kernel-janitors,
linux-wireless
On Sat, May 20, 2023 at 10:05:08AM +0200, Christophe JAILLET wrote:
> 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 <christophe.jaillet@wanadoo.fr>
Reviewed-by: Simon Horman <simon.horman@corigine.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [wireless] wifi: wl3501_cs: Fix an error handling path in wl3501_probe()
2023-05-20 8:05 [PATCH wireless] wl3501_cs: Fix an error handling path in wl3501_probe() Christophe JAILLET
2023-05-24 10:26 ` Simon Horman
@ 2023-05-25 16:16 ` Kalle Valo
1 sibling, 0 replies; 3+ messages in thread
From: Kalle Valo @ 2023-05-25 16:16 UTC (permalink / raw)
To: Christophe JAILLET
Cc: Dominik Brodowski, linux-kernel, kernel-janitors,
Christophe JAILLET, linux-wireless
Christophe JAILLET <christophe.jaillet@wanadoo.fr> wrote:
> 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 <christophe.jaillet@wanadoo.fr>
> Reviewed-by: Simon Horman <simon.horman@corigine.com>
Patch applied to wireless-next.git, thanks.
391af06a02e7 wifi: wl3501_cs: Fix an error handling path in wl3501_probe()
--
https://patchwork.kernel.org/project/linux-wireless/patch/7cc9c9316489b7d69b36aeb0edd3123538500b41.1684569865.git.christophe.jaillet@wanadoo.fr/
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-05-25 16:17 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-20 8:05 [PATCH wireless] wl3501_cs: Fix an error handling path in wl3501_probe() Christophe JAILLET
2023-05-24 10:26 ` Simon Horman
2023-05-25 16:16 ` [wireless] wifi: " Kalle Valo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).