[PATCH 02/22] ASoC: codecs: es7241: Use dev_err_probe() helper
Kuninori Morimoto
kuninori.morimoto.gx at renesas.com
Tue Dec 14 03:08:23 CET 2021
From: Kuninori Morimoto <kuninori.morimoto.gx at renesas.com>
Use the dev_err_probe() helper, instead of open-coding the same
operation.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx at renesas.com>
---
sound/soc/codecs/es7241.c | 28 +++++++++-------------------
1 file changed, 9 insertions(+), 19 deletions(-)
diff --git a/sound/soc/codecs/es7241.c b/sound/soc/codecs/es7241.c
index 2344a0b03518..9f20bfb855b3 100644
--- a/sound/soc/codecs/es7241.c
+++ b/sound/soc/codecs/es7241.c
@@ -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,
--
2.25.1
More information about the Alsa-devel
mailing list