[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2E89032DDAA8B9408CB92943514A0337014C1B11E5@SW-EX-MBX01.diasemi.com>
Date: Fri, 24 Nov 2017 12:03:32 +0000
From: Adam Thomson <Adam.Thomson.Opensource@...semi.com>
To: SF Markus Elfring <elfring@...rs.sourceforge.net>,
"alsa-devel@...a-project.org" <alsa-devel@...a-project.org>,
"Support Opensource" <Support.Opensource@...semi.com>,
Adam Thomson <Adam.Thomson.Opensource@...semi.com>,
Jaroslav Kysela <perex@...ex.cz>,
"Liam Girdwood" <lgirdwood@...il.com>,
Mark Brown <broonie@...nel.org>, Takashi Iwai <tiwai@...e.com>
CC: LKML <linux-kernel@...r.kernel.org>,
"kernel-janitors@...r.kernel.org" <kernel-janitors@...r.kernel.org>
Subject: RE: [PATCH 2/3] ASoC: da7218: Use common error handling code in
da7218_of_to_pdata()
On 23 November 2017 20:06, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@...rs.sourceforge.net>
> Date: Thu, 23 Nov 2017 20:48:05 +0100
>
> Add a jump target so that a bit of exception handling can be better reused
> in an if branch of this function.
>
> Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>
Hmm. Doesn't really gain an awful lot this. Would understand if there were
multiple return paths, but in that case I'd have implemented something like
this anyway. Also your patch description isn't really correct. You're re-using
code from the sunny day scenario to handle an exception.
> ---
> sound/soc/codecs/da7218.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/sound/soc/codecs/da7218.c b/sound/soc/codecs/da7218.c
> index 25ab7443d803..93a0cb741751 100644
> --- a/sound/soc/codecs/da7218.c
> +++ b/sound/soc/codecs/da7218.c
> @@ -2524,10 +2524,9 @@ static struct da7218_pdata *da7218_of_to_pdata(struct
> snd_soc_codec *codec)
>
> hpldet_pdata = devm_kzalloc(codec->dev, sizeof(*hpldet_pdata),
> GFP_KERNEL);
> - if (!hpldet_pdata) {
> - of_node_put(hpldet_np);
> - return pdata;
> - }
> + if (!hpldet_pdata)
> + goto put_node;
> +
> pdata->hpldet_pdata = hpldet_pdata;
>
> if (of_property_read_u32(hpldet_np, "dlg,jack-rate-us",
> @@ -2561,6 +2560,7 @@ static struct da7218_pdata *da7218_of_to_pdata(struct
> snd_soc_codec *codec)
> if (of_property_read_bool(hpldet_np, "dlg,discharge"))
> hpldet_pdata->discharge = true;
>
> +put_node:
> of_node_put(hpldet_np);
> }
>
> --
> 2.15.0
Powered by blists - more mailing lists