From mboxrd@z Thu Jan 1 00:00:00 1970 From: Charles Keepax Subject: Re: [patch] ASoC: wm0010: set error code on allocation failure Date: Fri, 9 May 2014 17:18:08 +0100 Message-ID: <20140509161808.GE25203@opensource.wolfsonmicro.com> References: <20140509115538.GB32027@mwanda> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: <20140509115538.GB32027@mwanda> Sender: kernel-janitors-owner@vger.kernel.org To: Dan Carpenter Cc: Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , Dimitris Papastamos , Wei Yongjun , patches@opensource.wolfsonmicro.com, alsa-devel@alsa-project.org, kernel-janitors@vger.kernel.org List-Id: alsa-devel@alsa-project.org On Fri, May 09, 2014 at 02:55:38PM +0300, Dan Carpenter wrote: > We should return -ENOMEM if the kzalloc() fails instead of returning > -ENOMEM. > > Signed-off-by: Dan Carpenter > > diff --git a/sound/soc/codecs/wm0010.c b/sound/soc/codecs/wm0010.c > index 71ce315..8dac6c5 100644 > --- a/sound/soc/codecs/wm0010.c > +++ b/sound/soc/codecs/wm0010.c > @@ -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