Skip to content

Commit 640bf95

Browse files
tititiou36kuba-moo
authored andcommitted
3c589_cs: Fix an error handling path in tc589_probe()
Should tc589_config() fail, some resources need to be released as already done in the remove function. Fixes: 15b99ac ("[PATCH] pcmcia: add return value to _config() functions") Signed-off-by: Christophe JAILLET <[email protected]> Reviewed-by: Simon Horman <[email protected]> Link: https://lore.kernel.org/r/d8593ae867b24c79063646e36f9b18b0790107cb.1684575975.git.christophe.jaillet@wanadoo.fr Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 5b17a49 commit 640bf95

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

drivers/net/ethernet/3com/3c589_cs.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@ static int tc589_probe(struct pcmcia_device *link)
195195
{
196196
struct el3_private *lp;
197197
struct net_device *dev;
198+
int ret;
198199

199200
dev_dbg(&link->dev, "3c589_attach()\n");
200201

@@ -218,7 +219,15 @@ static int tc589_probe(struct pcmcia_device *link)
218219

219220
dev->ethtool_ops = &netdev_ethtool_ops;
220221

221-
return tc589_config(link);
222+
ret = tc589_config(link);
223+
if (ret)
224+
goto err_free_netdev;
225+
226+
return 0;
227+
228+
err_free_netdev:
229+
free_netdev(dev);
230+
return ret;
222231
}
223232

224233
static void tc589_detach(struct pcmcia_device *link)

0 commit comments

Comments
 (0)