msm: bam_dmux: check possible null pointer
__dev_alloc_skb() could return a null pointer. Check the return and
handle the out of memory situation properly instead of using the null
pointer.
Change-Id: If015df6459edfbe777363aec01f8ede4ca9f9a39
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 45f1033..d0bf0cd 100644
--- a/arch/arm/mach-msm/bam_dmux.c
+++ b/arch/arm/mach-msm/bam_dmux.c
@@ -238,6 +238,11 @@
INIT_WORK(&info->work, handle_bam_mux_cmd);
info->skb = __dev_alloc_skb(BUFFER_SIZE, GFP_KERNEL);
+ if (info->skb == NULL) {
+ pr_err("%s: unable to alloc skb\n", __func__);
+ kfree(info);
+ return;
+ }
ptr = skb_put(info->skb, BUFFER_SIZE);
mutex_lock(&bam_rx_pool_mutexlock);