aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/firewire/fw-ohci.c
diff options
context:
space:
mode:
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 e6fa3496183e..4512edba6cb0 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)
431 packet->payload, 431 packet->payload,
432 packet->payload_length, 432 packet->payload_length,
433 DMA_TO_DEVICE); 433 DMA_TO_DEVICE);
434 if (packet->payload_bus == 0) { 434 if (dma_mapping_error(packet->payload_bus)) {
435 complete_transmission(packet, RCODE_SEND_ERROR, list); 435 complete_transmission(packet, RCODE_SEND_ERROR, list);
436 return; 436 return;
437 } 437 }
@@ -590,7 +590,7 @@ at_context_init(struct at_context *ctx, struct fw_ohci *ohci, u32 regs)
590 ctx->descriptor_bus = 590 ctx->descriptor_bus =
591 dma_map_single(ohci->card.device, &ctx->d, 591 dma_map_single(ohci->card.device, &ctx->d,
592 sizeof ctx->d, DMA_TO_DEVICE); 592 sizeof ctx->d, DMA_TO_DEVICE);
593 if (ctx->descriptor_bus == 0) 593 if (dma_mapping_error(ctx->descriptor_bus))
594 return -ENOMEM; 594 return -ENOMEM;
595 595
596 ctx->regs = regs; 596 ctx->regs = regs;
@@ -1159,16 +1159,14 @@ static struct fw_iso_context *ohci_allocate_iso_context(struct fw_card *card,
1159 tasklet_init(&ctx->tasklet, tasklet, (unsigned long)ctx); 1159 tasklet_init(&ctx->tasklet, tasklet, (unsigned long)ctx);
1160 1160
1161 ctx->buffer = kmalloc(ISO_BUFFER_SIZE, GFP_KERNEL); 1161 ctx->buffer = kmalloc(ISO_BUFFER_SIZE, GFP_KERNEL);
1162 if (ctx->buffer == NULL) { 1162 if (ctx->buffer == NULL)
1163 spin_lock_irqsave(&ohci->lock, flags); 1163 goto buffer_alloc_failed;
1164 *mask |= 1 << index;
1165 spin_unlock_irqrestore(&ohci->lock, flags);
1166 return ERR_PTR(-ENOMEM);
1167 }
1168 1164
1169 ctx->buffer_bus = 1165 ctx->buffer_bus =
1170 dma_map_single(card->device, ctx->buffer, 1166 dma_map_single(card->device, ctx->buffer,
1171 ISO_BUFFER_SIZE, DMA_TO_DEVICE); 1167 ISO_BUFFER_SIZE, DMA_TO_DEVICE);
1168 if (dma_mapping_error(ctx->buffer_bus))
1169 goto buffer_map_failed;
1172 1170
1173 ctx->head_descriptor = ctx->buffer; 1171 ctx->head_descriptor = ctx->buffer;
1174 ctx->prev_descriptor = ctx->buffer; 1172 ctx->prev_descriptor = ctx->buffer;
@@ -1187,6 +1185,15 @@ static struct fw_iso_context *ohci_allocate_iso_context(struct fw_card *card,
1187 ctx->head_descriptor++; 1185 ctx->head_descriptor++;
1188 1186
1189 return &ctx->base; 1187 return &ctx->base;
1188
1189 buffer_map_failed:
1190 kfree(ctx->buffer);
1191 buffer_alloc_failed:
1192 spin_lock_irqsave(&ohci->lock, flags);
1193 *mask |= 1 << index;
1194 spin_unlock_irqrestore(&ohci->lock, flags);
1195
1196 return ERR_PTR(-ENOMEM);
1190} 1197}
1191 1198
1192static int ohci_send_iso(struct fw_iso_context *base, s32 cycle) 1199static int ohci_send_iso(struct fw_iso_context *base, s32 cycle)