crypto: cavium/nitrox - Fix an error handling path in 'nitrox_probe()'
authorChristophe Jaillet <christophe.jaillet@wanadoo.fr>
Wed, 16 Aug 2017 05:16:06 +0000 (07:16 +0200)
committerHerbert Xu <herbert@gondor.apana.org.au>
Tue, 22 Aug 2017 06:54:55 +0000 (14:54 +0800)
'err' is known to be 0 at this point.
If 'kzalloc()' fails, returns -ENOMEM instead of 0 which means success.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/cavium/nitrox/nitrox_main.c

index 9ccefb9b7232ef68501c04db31aa7ac3ee983525..fee7cb2ce747c77e97b7a8f4a62eeb452b263147 100644 (file)
@@ -513,8 +513,10 @@ static int nitrox_probe(struct pci_dev *pdev,
        pci_set_master(pdev);
 
        ndev = kzalloc(sizeof(*ndev), GFP_KERNEL);
-       if (!ndev)
+       if (!ndev) {
+               err = -ENOMEM;
                goto ndev_fail;
+       }
 
        pci_set_drvdata(pdev, ndev);
        ndev->pdev = pdev;