Skip to content

Commit

Permalink
ASoC: sti-sas: Fix checking return value for ERR_PTR
Browse files Browse the repository at this point in the history
Both devm_regmap_init and syscon_regmap_lookup_by_phandle return ERR_PTR
on failure.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
  • Loading branch information
Axel Lin authored and Mark Brown committed Jul 13, 2015
1 parent 32a726b commit e27d9ee
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions sound/soc/codecs/sti-sas.c
Original file line number Diff line number Diff line change
Expand Up @@ -568,17 +568,17 @@ static int sti_sas_driver_probe(struct platform_device *pdev)
/* Request the DAC & SPDIF registers memory region */
drvdata->dac.virt_regmap = devm_regmap_init(&pdev->dev, NULL, drvdata,
drvdata->dev_data->regmap);
if (!drvdata->dac.virt_regmap) {
if (IS_ERR(drvdata->dac.virt_regmap)) {
dev_err(&pdev->dev, "audio registers not enabled\n");
return -EFAULT;
return PTR_ERR(drvdata->dac.virt_regmap);
}

/* Request the syscon region */
drvdata->dac.regmap =
syscon_regmap_lookup_by_phandle(pnode, "st,syscfg");
if (!drvdata->dac.regmap) {
if (IS_ERR(drvdata->dac.regmap)) {
dev_err(&pdev->dev, "syscon registers not available\n");
return -EFAULT;
return PTR_ERR(drvdata->dac.regmap);
}
drvdata->spdif.regmap = drvdata->dac.regmap;

Expand Down

0 comments on commit e27d9ee

Please sign in to comment.