mirror of https://gitee.com/openkylin/linux.git
crypto: cavium/nitrox - Fix an error rhandling path in 'nitrox_probe()'
If an error occurs after a successful 'ioremap()' call, it must be undone
by a corresponding 'iounmap()' call, as already done in the remove
function.
Add a 'pf_sw_fail' label in the error handling path and add the missing
'iounmap()'.
While at it, also add a 'flr_fail' label in the error handling path and use
it to avoid some code duplication.
Fixes: 14fa93cdcd
("crypto: cavium - Add support for CNN55XX adapters.")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
parent
5cd259ca5d
commit
0dc64297c8
|
@ -424,8 +424,7 @@ static int nitrox_probe(struct pci_dev *pdev,
|
||||||
err = nitrox_device_flr(pdev);
|
err = nitrox_device_flr(pdev);
|
||||||
if (err) {
|
if (err) {
|
||||||
dev_err(&pdev->dev, "FLR failed\n");
|
dev_err(&pdev->dev, "FLR failed\n");
|
||||||
pci_disable_device(pdev);
|
goto flr_fail;
|
||||||
return err;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64))) {
|
if (!dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64))) {
|
||||||
|
@ -434,17 +433,13 @@ static int nitrox_probe(struct pci_dev *pdev,
|
||||||
err = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
|
err = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
|
||||||
if (err) {
|
if (err) {
|
||||||
dev_err(&pdev->dev, "DMA configuration failed\n");
|
dev_err(&pdev->dev, "DMA configuration failed\n");
|
||||||
pci_disable_device(pdev);
|
goto flr_fail;
|
||||||
return err;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
err = pci_request_mem_regions(pdev, nitrox_driver_name);
|
err = pci_request_mem_regions(pdev, nitrox_driver_name);
|
||||||
if (err) {
|
if (err)
|
||||||
pci_disable_device(pdev);
|
goto flr_fail;
|
||||||
dev_err(&pdev->dev, "Failed to request mem regions!\n");
|
|
||||||
return err;
|
|
||||||
}
|
|
||||||
pci_set_master(pdev);
|
pci_set_master(pdev);
|
||||||
|
|
||||||
ndev = kzalloc(sizeof(*ndev), GFP_KERNEL);
|
ndev = kzalloc(sizeof(*ndev), GFP_KERNEL);
|
||||||
|
@ -480,7 +475,7 @@ static int nitrox_probe(struct pci_dev *pdev,
|
||||||
|
|
||||||
err = nitrox_pf_sw_init(ndev);
|
err = nitrox_pf_sw_init(ndev);
|
||||||
if (err)
|
if (err)
|
||||||
goto ioremap_err;
|
goto pf_sw_fail;
|
||||||
|
|
||||||
err = nitrox_pf_hw_init(ndev);
|
err = nitrox_pf_hw_init(ndev);
|
||||||
if (err)
|
if (err)
|
||||||
|
@ -510,12 +505,15 @@ static int nitrox_probe(struct pci_dev *pdev,
|
||||||
smp_mb__after_atomic();
|
smp_mb__after_atomic();
|
||||||
pf_hw_fail:
|
pf_hw_fail:
|
||||||
nitrox_pf_sw_cleanup(ndev);
|
nitrox_pf_sw_cleanup(ndev);
|
||||||
|
pf_sw_fail:
|
||||||
|
iounmap(ndev->bar_addr);
|
||||||
ioremap_err:
|
ioremap_err:
|
||||||
nitrox_remove_from_devlist(ndev);
|
nitrox_remove_from_devlist(ndev);
|
||||||
kfree(ndev);
|
kfree(ndev);
|
||||||
pci_set_drvdata(pdev, NULL);
|
pci_set_drvdata(pdev, NULL);
|
||||||
ndev_fail:
|
ndev_fail:
|
||||||
pci_release_mem_regions(pdev);
|
pci_release_mem_regions(pdev);
|
||||||
|
flr_fail:
|
||||||
pci_disable_device(pdev);
|
pci_disable_device(pdev);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue