[alsa-devel] [PATCH 2/3] ASoC: da7218: Use common error handling code in da7218_of_to_pdata()
SF Markus Elfring
elfring at users.sourceforge.net
Thu Nov 23 21:06:00 CET 2017
From: Markus Elfring <elfring at users.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 at users.sourceforge.net>
---
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
More information about the Alsa-devel
mailing list