mirror of
https://github.com/torvalds/linux.git
synced 2024-11-27 14:41:39 +00:00
ASoC: codecs: es7241: Use dev_err_probe() helper
Use the dev_err_probe() helper, instead of open-coding the same operation. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/20211214020843.2225831-3-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
5ea4e76b73
commit
900b4b911a
@ -255,7 +255,6 @@ static int es7241_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct device *dev = &pdev->dev;
|
||||
struct es7241_data *priv;
|
||||
int err;
|
||||
|
||||
priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
|
||||
if (!priv)
|
||||
@ -271,28 +270,19 @@ static int es7241_probe(struct platform_device *pdev)
|
||||
es7241_parse_fmt(dev, priv);
|
||||
|
||||
priv->reset = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW);
|
||||
if (IS_ERR(priv->reset)) {
|
||||
err = PTR_ERR(priv->reset);
|
||||
if (err != -EPROBE_DEFER)
|
||||
dev_err(dev, "Failed to get 'reset' gpio: %d", err);
|
||||
return err;
|
||||
}
|
||||
if (IS_ERR(priv->reset))
|
||||
return dev_err_probe(dev, PTR_ERR(priv->reset),
|
||||
"Failed to get 'reset' gpio");
|
||||
|
||||
priv->m0 = devm_gpiod_get_optional(dev, "m0", GPIOD_OUT_LOW);
|
||||
if (IS_ERR(priv->m0)) {
|
||||
err = PTR_ERR(priv->m0);
|
||||
if (err != -EPROBE_DEFER)
|
||||
dev_err(dev, "Failed to get 'm0' gpio: %d", err);
|
||||
return err;
|
||||
}
|
||||
if (IS_ERR(priv->m0))
|
||||
return dev_err_probe(dev, PTR_ERR(priv->m0),
|
||||
"Failed to get 'm0' gpio");
|
||||
|
||||
priv->m1 = devm_gpiod_get_optional(dev, "m1", GPIOD_OUT_LOW);
|
||||
if (IS_ERR(priv->m1)) {
|
||||
err = PTR_ERR(priv->m1);
|
||||
if (err != -EPROBE_DEFER)
|
||||
dev_err(dev, "Failed to get 'm1' gpio: %d", err);
|
||||
return err;
|
||||
}
|
||||
if (IS_ERR(priv->m1))
|
||||
return dev_err_probe(dev, PTR_ERR(priv->m1),
|
||||
"Failed to get 'm1' gpio");
|
||||
|
||||
return devm_snd_soc_register_component(&pdev->dev,
|
||||
&es7241_component_driver,
|
||||
|
Loading…
Reference in New Issue
Block a user