Skip to content

Commit

Permalink
ASoC: cs42xx8: Move the code checking *regmap argument earlier
Browse files Browse the repository at this point in the history
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>
Acked-by: Brian Austin <brian.austin@cirrus.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
  • Loading branch information
Axel Lin authored and Mark Brown committed Jul 7, 2015
1 parent d770e55 commit d375d0a
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions sound/soc/codecs/cs42xx8.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit d375d0a

Please sign in to comment.