Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=ff487fb773749124550a5ad2b7fbfe0376af6f0d
Commit:     ff487fb773749124550a5ad2b7fbfe0376af6f0d
Parent:     000725d56a196e72dc22328324c5ec5506265736
Author:     Jeff Garzik <[EMAIL PROTECTED]>
AuthorDate: Thu Mar 8 09:57:34 2007 -0800
Committer:  Dan Williams <[EMAIL PROTECTED]>
CommitDate: Wed Jul 11 15:39:03 2007 -0700

    drivers/dma: handle sysfs errors
    
    From: Jeff Garzik <[EMAIL PROTECTED]>
    
    Signed-off-by: Jeff Garzik <[EMAIL PROTECTED]>
    Signed-off-by: Chris Leech <[EMAIL PROTECTED]>
---
 drivers/dma/dmaengine.c |   22 ++++++++++++++++++++--
 1 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/drivers/dma/dmaengine.c b/drivers/dma/dmaengine.c
index 322ee29..828310d 100644
--- a/drivers/dma/dmaengine.c
+++ b/drivers/dma/dmaengine.c
@@ -316,7 +316,7 @@ EXPORT_SYMBOL(dma_async_client_chan_request);
 int dma_async_device_register(struct dma_device *device)
 {
        static int id;
-       int chancnt = 0;
+       int chancnt = 0, rc;
        struct dma_chan* chan;
 
        if (!device)
@@ -338,8 +338,15 @@ int dma_async_device_register(struct dma_device *device)
                snprintf(chan->class_dev.class_id, BUS_ID_SIZE, "dma%dchan%d",
                         device->dev_id, chan->chan_id);
 
+               rc = class_device_register(&chan->class_dev);
+               if (rc) {
+                       chancnt--;
+                       free_percpu(chan->local);
+                       chan->local = NULL;
+                       goto err_out;
+               }
+
                kref_get(&device->refcount);
-               class_device_register(&chan->class_dev);
        }
 
        mutex_lock(&dma_list_mutex);
@@ -349,6 +356,17 @@ int dma_async_device_register(struct dma_device *device)
        dma_chans_rebalance();
 
        return 0;
+
+err_out:
+       list_for_each_entry(chan, &device->channels, device_node) {
+               if (chan->local == NULL)
+                       continue;
+               kref_put(&device->refcount, dma_async_device_cleanup);
+               class_device_unregister(&chan->class_dev);
+               chancnt--;
+               free_percpu(chan->local);
+       }
+       return rc;
 }
 EXPORT_SYMBOL(dma_async_device_register);
 
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to