[<prev] [next>] [day] [month] [year] [list]
Message-ID: <3b978ab5-5a7f-369f-c663-938955a36e58@users.sourceforge.net>
Date: Sun, 19 Nov 2017 09:09:38 +0100
From: SF Markus Elfring <elfring@...rs.sourceforge.net>
To: alsa-devel@...a-project.org, Bhumika Goyal <bhumirks@...il.com>,
Jaroslav Kysela <perex@...ex.cz>,
Kuninori Morimoto <kuninori.morimoto.gx@...esas.com>,
Liam Girdwood <lgirdwood@...il.com>,
Mark Brown <broonie@...nel.org>, Rob Herring <robh@...nel.org>,
Takashi Iwai <tiwai@...e.com>, Tony Lindgren <tony@...mide.com>
Cc: LKML <linux-kernel@...r.kernel.org>,
kernel-janitors@...r.kernel.org
Subject: [PATCH] ASoC: audio-graph-scu-card: Use common error handling code in
asoc_graph_card_parse_of()
From: Markus Elfring <elfring@...rs.sourceforge.net>
Date: Sun, 19 Nov 2017 08:51:41 +0100
Add a jump target so that a bit of exception handling can be better reused
at the end of this function.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>
---
sound/soc/generic/audio-graph-scu-card.c | 22 +++++++++-------------
1 file changed, 9 insertions(+), 13 deletions(-)
diff --git a/sound/soc/generic/audio-graph-scu-card.c b/sound/soc/generic/audio-graph-scu-card.c
index a967aa143d51..c4b999fba7e6 100644
--- a/sound/soc/generic/audio-graph-scu-card.c
+++ b/sound/soc/generic/audio-graph-scu-card.c
@@ -231,10 +231,8 @@ static int asoc_graph_card_parse_of(struct graph_card_data *priv)
ret = asoc_simple_card_parse_daifmt(dev, cpu_ep, codec_ep,
NULL, &daifmt);
- if (ret < 0) {
- of_node_put(cpu_port);
- goto parse_of_err;
- }
+ if (ret < 0)
+ goto put_node;
}
dai_idx = 0;
@@ -266,17 +264,13 @@ static int asoc_graph_card_parse_of(struct graph_card_data *priv)
/* Back-End (= Codec) */
ret = asoc_graph_card_dai_link_of(codec_ep, priv, daifmt, dai_idx++, 0);
- if (ret < 0) {
- of_node_put(cpu_port);
- goto parse_of_err;
- }
+ if (ret < 0)
+ goto put_node;
} else {
/* Front-End (= CPU) */
ret = asoc_graph_card_dai_link_of(cpu_ep, priv, daifmt, dai_idx++, 1);
- if (ret < 0) {
- of_node_put(cpu_port);
- goto parse_of_err;
- }
+ if (ret < 0)
+ goto put_node;
}
}
}
@@ -285,8 +279,10 @@ static int asoc_graph_card_parse_of(struct graph_card_data *priv)
if (ret)
goto parse_of_err;
- ret = 0;
+ return 0;
+put_node:
+ of_node_put(cpu_port);
parse_of_err:
return ret;
}
--
2.15.0
Powered by blists - more mailing lists