Skip to content

Commit 32e67b9

Browse files
tititiou36herbertx
authored andcommitted
crypto: cavium/nitrox - Fix an error handling path in 'nitrox_probe()'
'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 <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
1 parent b7d65fe commit 32e67b9

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/crypto/cavium/nitrox/nitrox_main.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -513,8 +513,10 @@ static int nitrox_probe(struct pci_dev *pdev,
513513
pci_set_master(pdev);
514514

515515
ndev = kzalloc(sizeof(*ndev), GFP_KERNEL);
516-
if (!ndev)
516+
if (!ndev) {
517+
err = -ENOMEM;
517518
goto ndev_fail;
519+
}
518520

519521
pci_set_drvdata(pdev, ndev);
520522
ndev->pdev = pdev;

0 commit comments

Comments
 (0)