From: Chris Leech <christopher.leech@intel.com>
To: linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
akpm@osdl.org, jeff@garzik.org
Subject: [PATCH 2/7] drivers/dma: handle sysfs errors
Date: Wed, 18 Oct 2006 16:46:51 -0700 [thread overview]
Message-ID: <20061018234650.26671.1529.stgit@gitlost.site> (raw)
In-Reply-To: <20061018234417.26671.56773.stgit@gitlost.site>
From: Jeff Garzik <jeff@garzik.org>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Signed-off-by: Chris Leech <christopher.leech@intel.com>
---
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 1527804..dc65773 100644
--- a/drivers/dma/dmaengine.c
+++ b/drivers/dma/dmaengine.c
@@ -312,7 +312,7 @@ void dma_async_client_chan_request(struc
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)
@@ -334,8 +334,15 @@ int dma_async_device_register(struct dma
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);
@@ -345,6 +352,17 @@ int dma_async_device_register(struct dma
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;
}
/**
next prev parent reply other threads:[~2006-10-18 23:46 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-10-18 23:44 [PATCH 0/7] drivers/dma & I/OAT fixes Chris Leech
2006-10-18 23:46 ` [PATCH 1/7] I/OAT: Push pending transactions to hardware more frequently Chris Leech
2006-10-18 23:46 ` Chris Leech [this message]
2006-10-18 23:46 ` [PATCH 3/7] I/OAT: Remove the wrappers around read(bwl)/write(bwl) in ioatdma Chris Leech
2006-10-18 23:46 ` [PATCH 4/7] I/OAT: Remove the use of writeq from the ioatdma driver Chris Leech
2006-10-18 23:46 ` [PATCH 5/7] I/OAT: Add documentation for the tcp_dma_copybreak sysctl Chris Leech
2006-10-18 23:46 ` [PATCH 6/7] I/OAT: Add entries to MAINTAINERS for the DMA memcpy subsystem and ioatdma Chris Leech
2006-10-18 23:47 ` [PATCH 7/7] I/OAT: Only offload copies for TCP when there will be a context switch Chris Leech
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20061018234650.26671.1529.stgit@gitlost.site \
--to=christopher.leech@intel.com \
--cc=akpm@osdl.org \
--cc=jeff@garzik.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).