All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] ASoC: cs42xx8: Move the code checking *regmap argument earlier
@ 2015-06-25 13:41 Axel Lin
  2015-06-25 13:44 ` [PATCH 2/2] ASoC: cs42xx8: Setup of_match_table Axel Lin
  2015-07-07 13:57 ` Applied "ASoC: cs42xx8: Move the code checking *regmap argument earlier" " Mark Brown
  0 siblings, 2 replies; 5+ messages in thread
From: Axel Lin @ 2015-06-25 13:41 UTC (permalink / raw)
  To: Mark Brown; +Cc: Brian Austin, alsa-devel, Liam Girdwood, Paul Handrigan

Slightly improve the readability by moving the code checking *regmap
argument earlier. Also move the assignment of of_id close to the place
testing it.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
 sound/soc/codecs/cs42xx8.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/sound/soc/codecs/cs42xx8.c b/sound/soc/codecs/cs42xx8.c
index e1d4686..ab39514 100644
--- a/sound/soc/codecs/cs42xx8.c
+++ b/sound/soc/codecs/cs42xx8.c
@@ -435,16 +435,24 @@ EXPORT_SYMBOL_GPL(cs42xx8_of_match);
 
 int cs42xx8_probe(struct device *dev, struct regmap *regmap)
 {
-	const struct of_device_id *of_id = of_match_device(cs42xx8_of_match, dev);
+	const struct of_device_id *of_id;
 	struct cs42xx8_priv *cs42xx8;
 	int ret, val, i;
 
+	if (IS_ERR(regmap)) {
+		ret = PTR_ERR(regmap);
+		dev_err(dev, "failed to allocate regmap: %d\n", ret);
+		return ret;
+	}
+
 	cs42xx8 = devm_kzalloc(dev, sizeof(*cs42xx8), GFP_KERNEL);
 	if (cs42xx8 == NULL)
 		return -ENOMEM;
 
+	cs42xx8->regmap = regmap;
 	dev_set_drvdata(dev, cs42xx8);
 
+	of_id = of_match_device(cs42xx8_of_match, dev);
 	if (of_id)
 		cs42xx8->drvdata = of_id->data;
 
@@ -482,13 +490,6 @@ int cs42xx8_probe(struct device *dev, struct regmap *regmap)
 	/* Make sure hardware reset done */
 	msleep(5);
 
-	cs42xx8->regmap = regmap;
-	if (IS_ERR(cs42xx8->regmap)) {
-		ret = PTR_ERR(cs42xx8->regmap);
-		dev_err(dev, "failed to allocate regmap: %d\n", ret);
-		goto err_enable;
-	}
-
 	/*
 	 * We haven't marked the chip revision as volatile due to
 	 * sharing a register with the right input volume; explicitly
-- 
2.1.0

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-07-07 13:58 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-25 13:41 [PATCH 1/2] ASoC: cs42xx8: Move the code checking *regmap argument earlier Axel Lin
2015-06-25 13:44 ` [PATCH 2/2] ASoC: cs42xx8: Setup of_match_table Axel Lin
2015-06-26 18:29   ` Brian Austin
2015-07-07 13:57   ` Applied "ASoC: cs42xx8: Setup of_match_table" to the asoc tree Mark Brown
2015-07-07 13:57 ` Applied "ASoC: cs42xx8: Move the code checking *regmap argument earlier" " Mark Brown

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.