ASoC: wm0010: set error code on allocation failure
Subsystems (4)
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
@@ -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; }
Quoted 10 lines · Dan Carpenter
We should return
-ENOMEMif thekzalloc()fails instead of returning-ENOMEM.Signed-off-by Dan Carpenter <[email protected]>sound/soc/codecs/wm0010.c +0
-0
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
Quoted 6 lines · Charles Keepax
Quoted 5 lines · Dan Carpenter
We should return
-ENOMEMif thekzalloc()fails instead of returning-ENOMEM.Signed-off-by Dan Carpenter <[email protected]>
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@@ -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