arcnet: com20020-pci: Fix an error handling path in 'com20020pci_probe()'
authorChristophe Jaillet <christophe.jaillet@wanadoo.fr>
Fri, 7 Jul 2017 04:56:16 +0000 (06:56 +0200)
committerDavid S. Miller <davem@davemloft.net>
Fri, 7 Jul 2017 08:29:10 +0000 (09:29 +0100)
If this memory allocation fails, we should go through the error handling
path as done everywhere else in this function before returning.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/arcnet/com20020-pci.c

index 2d956cb59d06d33c2f605a988a5884b1c21a1012..01cab95487858f094319e4c3ca4748b33e4b9ff7 100644 (file)
@@ -225,8 +225,10 @@ static int com20020pci_probe(struct pci_dev *pdev,
 
                card = devm_kzalloc(&pdev->dev, sizeof(struct com20020_dev),
                                    GFP_KERNEL);
-               if (!card)
-                       return -ENOMEM;
+               if (!card) {
+                       ret = -ENOMEM;
+                       goto out_port;
+               }
 
                card->index = i;
                card->pci_priv = priv;