msm: bam_dmux: clean up after write failure
If the packet is unable to be queued to BAM, all references to data
structures must be removed from shared lists and the resources released.
CRs-Fixed: 316304
Change-Id: I73d48c585648787000d5e6bf6a9da55f721dddf6
Signed-off-by: Jeffrey Hugo <jhugo@codeaurora.org>
diff --git a/arch/arm/mach-msm/bam_dmux.c b/arch/arm/mach-msm/bam_dmux.c
index ace645b..0cd8a6e 100644
--- a/arch/arm/mach-msm/bam_dmux.c
+++ b/arch/arm/mach-msm/bam_dmux.c
@@ -362,6 +362,13 @@
spin_unlock(&bam_tx_pool_spinlock);
rc = sps_transfer_one(bam_tx_pipe, dma_address, len,
pkt, SPS_IOVEC_FLAG_INT | SPS_IOVEC_FLAG_EOT);
+ if (rc) {
+ DBG("%s sps_transfer_one failed rc=%d\n", __func__, rc);
+ spin_lock(&bam_tx_pool_spinlock);
+ list_del(&pkt->list_node);
+ spin_unlock(&bam_tx_pool_spinlock);
+ kfree(pkt);
+ }
ul_packet_written = 1;
return rc;
@@ -487,6 +494,13 @@
spin_unlock(&bam_tx_pool_spinlock);
rc = sps_transfer_one(bam_tx_pipe, dma_address, skb->len,
pkt, SPS_IOVEC_FLAG_INT | SPS_IOVEC_FLAG_EOT);
+ if (rc) {
+ DBG("%s sps_transfer_one failed rc=%d\n", __func__, rc);
+ spin_lock(&bam_tx_pool_spinlock);
+ list_del(&pkt->list_node);
+ spin_unlock(&bam_tx_pool_spinlock);
+ kfree(pkt);
+ }
ul_packet_written = 1;
read_unlock(&ul_wakeup_lock);
return rc;