From 549e8292a1e7712d401cc8b8df88286cdfff9f08 Mon Sep 17 00:00:00 2001
From: Takashi Iwai <tiwai@suse.de>
Date: Tue, 15 Jan 2013 17:42:15 +0100
Subject: [PATCH 24/29] ALSA: hda/ca0132 - Fix possible NULL dereference
Git-commit: 549e8292a1e7712d401cc8b8df88286cdfff9f08
Patch-mainline: 3.9-rc1
References: bnc#814440,FATE#314291

Spotted by smatch,
  sound/pci/hda/patch_ca0132.c:1950 dspxfr_image() error: potential
  null dereference 'dma_engine'.  (kzalloc returns null)
  sound/pci/hda/patch_ca0132.c:1950 dspxfr_image() error: we
  previously assumed 'dma_engine' could be null (see line 1857)

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>

---
 sound/pci/hda/patch_ca0132.c |   10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

--- a/sound/pci/hda/patch_ca0132.c
+++ b/sound/pci/hda/patch_ca0132.c
@@ -2416,15 +2416,13 @@ static int dspxfr_image(struct hda_codec
 		return -EINVAL;
 
 	dma_engine = kzalloc(sizeof(*dma_engine), GFP_KERNEL);
-	if (!dma_engine) {
-		status = -ENOMEM;
-		goto exit;
-	}
+	if (!dma_engine)
+		return -ENOMEM;
 
 	dma_engine->dmab = kzalloc(sizeof(*dma_engine->dmab), GFP_KERNEL);
 	if (!dma_engine->dmab) {
-		status = -ENOMEM;
-		goto exit;
+		kfree(dma_engine);
+		return -ENOMEM;
 	}
 
 	dma_engine->codec = codec;
