The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH] ioatdma:  Release memory in error handling path
@ 2010-04-12  3:41 minskey
  2010-04-12  4:00 ` [PATCH V2 ] " minskey
  0 siblings, 1 reply; 2+ messages in thread
From: minskey @ 2010-04-12  3:41 UTC (permalink / raw)
  To: linux-kernel; +Cc: dan.j.williams


Release memory in error handling path

Signed-off-by: Minskey Guo <chaohong_guo@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



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH V2 ] ioatdma:  Release memory in error handling path
  2010-04-12  3:41 [PATCH] ioatdma: Release memory in error handling path minskey
@ 2010-04-12  4:00 ` minskey
  0 siblings, 0 replies; 2+ messages in thread
From: minskey @ 2010-04-12  4:00 UTC (permalink / raw)
  To: linux-kernel; +Cc: dan.j.williams


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


    Release memory in error handling path

Signed-off-by: Minskey Guo <chaohong_guo@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@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@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/



^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-04-12  4:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-12  3:41 [PATCH] ioatdma: Release memory in error handling path minskey
2010-04-12  4:00 ` [PATCH V2 ] " minskey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox