Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

wifi: orinoco: Fix an error handling path in orinoco_cs_probe()

Should orinoco_cs_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
orinoco_cs_probe(), not orinoco_cs_attach().

Fixes: 15b99ac17295 ("[PATCH] pcmcia: add return value to _config() functions")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/e24735ce4d82901d5f7ea08419eea53bfdde3d65.1684568286.git.christophe.jaillet@wanadoo.fr

authored by

Christophe JAILLET and committed by
Kalle Valo
67a81d91 92524432

+11 -2
+11 -2
drivers/net/wireless/intersil/orinoco/orinoco_cs.c
··· 96 96 { 97 97 struct orinoco_private *priv; 98 98 struct orinoco_pccard *card; 99 + int ret; 99 100 100 101 priv = alloc_orinocodev(sizeof(*card), &link->dev, 101 102 orinoco_cs_hard_reset, NULL); ··· 108 107 card->p_dev = link; 109 108 link->priv = priv; 110 109 111 - return orinoco_cs_config(link); 112 - } /* orinoco_cs_attach */ 110 + ret = orinoco_cs_config(link); 111 + if (ret) 112 + goto err_free_orinocodev; 113 + 114 + return 0; 115 + 116 + err_free_orinocodev: 117 + free_orinocodev(priv); 118 + return ret; 119 + } 113 120 114 121 static void orinoco_cs_detach(struct pcmcia_device *link) 115 122 {