summaryrefslogtreecommitdiffstats
path: root/drivers/firewire/fw-ohci.c
diff options
context:
space:
mode:
authorKristian Høgsberg <krh@redhat.com>2007-02-06 14:49:40 -0500
committerStefan Richter <stefanr@s5r6.in-berlin.de>2007-03-09 22:02:55 +0100
commit82eff9db7dc5d8f78898d5051975d14f48be2028 (patch)
tree4f65c617d165f90cee98d84373452b160be23349 /drivers/firewire/fw-ohci.c
parent27a15e50fb87978d7e1e9f7b561f78692e0b1eb5 (diff)
downloadop-kernel-dev-82eff9db7dc5d8f78898d5051975d14f48be2028.zip
op-kernel-dev-82eff9db7dc5d8f78898d5051975d14f48be2028.tar.gz
firewire: Use dma_mapping_error() for checking for DMA mapping errors.
Pointed out by Pete Zaitcev. Signed-off-by: Kristian Høgsberg <krh@redhat.com> Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Diffstat (limited to 'drivers/firewire/fw-ohci.c')
-rw-r--r--drivers/firewire/fw-ohci.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/drivers/firewire/fw-ohci.c b/drivers/firewire/fw-ohci.c
index e6fa349..4512edb 100644
--- a/drivers/firewire/fw-ohci.c
+++ b/drivers/firewire/fw-ohci.c
@@ -431,7 +431,7 @@ at_context_setup_packet(struct at_context *ctx, struct list_head *list)
packet->payload,
packet->payload_length,
DMA_TO_DEVICE);
- if (packet->payload_bus == 0) {
+ if (dma_mapping_error(packet->payload_bus)) {
complete_transmission(packet, RCODE_SEND_ERROR, list);
return;
}
@@ -590,7 +590,7 @@ at_context_init(struct at_context *ctx, struct fw_ohci *ohci, u32 regs)
ctx->descriptor_bus =
dma_map_single(ohci->card.device, &ctx->d,
sizeof ctx->d, DMA_TO_DEVICE);
- if (ctx->descriptor_bus == 0)
+ if (dma_mapping_error(ctx->descriptor_bus))
return -ENOMEM;
ctx->regs = regs;
@@ -1159,16 +1159,14 @@ static struct fw_iso_context *ohci_allocate_iso_context(struct fw_card *card,
tasklet_init(&ctx->tasklet, tasklet, (unsigned long)ctx);
ctx->buffer = kmalloc(ISO_BUFFER_SIZE, GFP_KERNEL);
- if (ctx->buffer == NULL) {
- spin_lock_irqsave(&ohci->lock, flags);
- *mask |= 1 << index;
- spin_unlock_irqrestore(&ohci->lock, flags);
- return ERR_PTR(-ENOMEM);
- }
+ if (ctx->buffer == NULL)
+ goto buffer_alloc_failed;
ctx->buffer_bus =
dma_map_single(card->device, ctx->buffer,
ISO_BUFFER_SIZE, DMA_TO_DEVICE);
+ if (dma_mapping_error(ctx->buffer_bus))
+ goto buffer_map_failed;
ctx->head_descriptor = ctx->buffer;
ctx->prev_descriptor = ctx->buffer;
@@ -1187,6 +1185,15 @@ static struct fw_iso_context *ohci_allocate_iso_context(struct fw_card *card,
ctx->head_descriptor++;
return &ctx->base;
+
+ buffer_map_failed:
+ kfree(ctx->buffer);
+ buffer_alloc_failed:
+ spin_lock_irqsave(&ohci->lock, flags);
+ *mask |= 1 << index;
+ spin_unlock_irqrestore(&ohci->lock, flags);
+
+ return ERR_PTR(-ENOMEM);
}
static int ohci_send_iso(struct fw_iso_context *base, s32 cycle)
OpenPOWER on IntegriCloud