From: minskey on

Very sorry, re-send it : correct for compiling error


Release memory in error handling path

Signed-off-by: Minskey Guo <chaohong_guo(a)linux.intel.com>

---
drivers/dma/ioat/pci.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/drivers/dma/ioat/pci.c b/drivers/dma/ioat/pci.c
index a6e93ee..2a3dae9 100644
--- a/drivers/dma/ioat/pci.c
+++ b/drivers/dma/ioat/pci.c
@@ -153,10 +153,12 @@ static int __devinit ioat_pci_probe(struct pci_dev
*pdev, const struct pci_devic
else if (device->version >= IOAT_VER_3_0)
err = ioat3_dma_probe(device, ioat_dca_enabled);
else
- return -ENODEV;
+ err = -ENODEV;

if (err) {
dev_err(dev, "Intel(R) I/OAT DMA Engine init failed\n");
+ pci_set_drvdata(pdev, NULL);
+ devm_kfree(dev, device);
return -ENODEV;
}
--
1.6.3.3


-minskey


在 2010-04-12一的 11:41 +0800,minskey写道:
> Release memory in error handling path
>
> Signed-off-by: Minskey Guo <chaohong_guo(a)linux.intel.com>
>
> ---
> drivers/dma/ioat/pci.c | 4 +++-
> 1 files changed, 3 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/dma/ioat/pci.c b/drivers/dma/ioat/pci.c
> index a6e93ee..2a3dae9 100644
> --- a/drivers/dma/ioat/pci.c
> +++ b/drivers/dma/ioat/pci.c
> @@ -153,10 +153,12 @@ static int __devinit ioat_pci_probe(struct pci_dev
> *pdev, const struct pci_devic
> else if (device->version >= IOAT_VER_3_0)
> err = ioat3_dma_probe(device, ioat_dca_enabled);
> else
> - return -ENODEV;
> + err = -ENODEV;
>
> if (err) {
> dev_err(dev, "Intel(R) I/OAT DMA Engine init failed\n");
> + pci_set_drvdata(pdev, NULL);
> + devm_kfree(dev, device)
> return -ENODEV;
> }
> --
> 1.6.3.3
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo(a)vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/