Commit 6df96c8f authored by Kuninori Morimoto's avatar Kuninori Morimoto Committed by Mark Brown

ASoC: codecs: max9759: Use dev_err_probe() helper

Use the dev_err_probe() helper, instead of open-coding the same
operation.
Signed-off-by: default avatarKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/20211214020843.2225831-4-kuninori.morimoto.gx@renesas.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 900b4b91
......@@ -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) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment