Skip to contentSkip to conversation

ASoC: wm0010: set error code on allocation failure

PATCH In review Dan Carpenter 2 participants 3 messages May 9, 2014

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ASoC: wm0010: set error code on allocation failure

We should return -ENOMEM if the kzalloc() fails instead of returning -ENOMEM.

sound/soc/codecs/wm0010.c +1 -0
index 71ce315..8dac6c5 100644
@@ -682,6 +682,7 @@ static int wm0010_boot(struct snd_soc_codec *codec)
 		if (!img_swap) {
 			dev_err(codec->dev,
 				"Failed to allocate image buffer\n");
+			ret = -ENOMEM;
 			goto abort;
 		}
 
#1 lore raw
Quoted 10 lines · Dan Carpenter

We should return -ENOMEM if the kzalloc() fails instead of returning -ENOMEM.

sound/soc/codecs/wm0010.c +0 -0
index 71ce315..8dac6c5 100644

sound/soc/codecs/wm0010.c static int wm0010_boot(struct snd_soc_codec *codec) · line 685

Quoted 4 lines
sound/soc/codecs/wm0010.c +1 -0
@@ -682,6 +682,7 @@ static int wm0010_boot(struct snd_soc_codec *codec)
 		if (!img_swap) {
 			dev_err(codec->dev,
 				"Failed to allocate image buffer\n");
+			ret = -ENOMEM;

No need to set this here, it is set 12 lines earlier. I agree the current code is not the most clear, but this patch is superfluous with the current state of the code.

Thanks,
Charles

#2 lore raw
Quoted 6 lines · Charles Keepax
Quoted 5 lines · Dan Carpenter

We should return -ENOMEM if the kzalloc() fails instead of returning -ENOMEM.

Quoted 12 lines

sound/soc/codecs/wm0010.c static int wm0010_boot(struct snd_soc_codec *codec) · line 685

Quoted 9 lines
sound/soc/codecs/wm0010.c +1 -0
index 71ce315..8dac6c5 100644
@@ -682,6 +682,7 @@ static int wm0010_boot(struct snd_soc_codec *codec)
 		if (!img_swap) {
 			dev_err(codec->dev,
 				"Failed to allocate image buffer\n");
+			ret = -ENOMEM;

No need to set this here, it is set 12 lines earlier. I agree the current code is not the most clear,

Oops. That was my bad. The code is actually totally clear, it was just sloppiness on my part. Sorry for that.

regards,
dan carpenter