ASoC: codecs: max9759: 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-4-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
diff --git a/sound/soc/codecs/max9759.c b/sound/soc/codecs/max9759.c
index 00e9d4f..d75fd61 100644
--- a/sound/soc/codecs/max9759.c
+++ b/sound/soc/codecs/max9759.c
@@ -140,7 +140,6 @@ static int max9759_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
struct max9759 *priv;
- int err;
priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
if (!priv)
@@ -149,29 +148,20 @@ static int max9759_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, priv);
priv->gpiod_shutdown = devm_gpiod_get(dev, "shutdown", GPIOD_OUT_HIGH);
- if (IS_ERR(priv->gpiod_shutdown)) {
- err = PTR_ERR(priv->gpiod_shutdown);
- if (err != -EPROBE_DEFER)
- dev_err(dev, "Failed to get 'shutdown' gpio: %d", err);
- return err;
- }
+ if (IS_ERR(priv->gpiod_shutdown))
+ return dev_err_probe(dev, PTR_ERR(priv->gpiod_shutdown),
+ "Failed to get 'shutdown' gpio");
priv->gpiod_mute = devm_gpiod_get(dev, "mute", GPIOD_OUT_HIGH);
- if (IS_ERR(priv->gpiod_mute)) {
- err = PTR_ERR(priv->gpiod_mute);
- if (err != -EPROBE_DEFER)
- dev_err(dev, "Failed to get 'mute' gpio: %d", err);
- return err;
- }
+ if (IS_ERR(priv->gpiod_mute))
+ return dev_err_probe(dev, PTR_ERR(priv->gpiod_mute),
+ "Failed to get 'mute' gpio");
priv->is_mute = true;
priv->gpiod_gain = devm_gpiod_get_array(dev, "gain", GPIOD_OUT_HIGH);
- if (IS_ERR(priv->gpiod_gain)) {
- err = PTR_ERR(priv->gpiod_gain);
- if (err != -EPROBE_DEFER)
- dev_err(dev, "Failed to get 'gain' gpios: %d", err);
- return err;
- }
+ if (IS_ERR(priv->gpiod_gain))
+ return dev_err_probe(dev, PTR_ERR(priv->gpiod_gain),
+ "Failed to get 'gain' gpios");
priv->gain = 0;
if (priv->gpiod_gain->ndescs != 2) {