Skip to content

Commit

Permalink
crypto: cavium/nitrox - Fix an error handling path in 'nitrox_probe()'
Browse files Browse the repository at this point in the history
'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>
  • Loading branch information
tititiou36 authored and herbertx committed Aug 22, 2017
1 parent b7d65fe commit 32e67b9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/crypto/cavium/nitrox/nitrox_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 32e67b9

Please sign in to comment.