mirror of
https://github.com/openwrt/openwrt.git
synced 2025-01-27 06:39:51 +00:00
74 lines
2.4 KiB
Diff
74 lines
2.4 KiB
Diff
|
From 61494a7aa2ea887fa1cd1399a8db1317c87f661b Mon Sep 17 00:00:00 2001
|
||
|
From: Phil Elwell <phil@raspberrypi.com>
|
||
|
Date: Thu, 12 Dec 2024 13:05:41 +0000
|
||
|
Subject: [PATCH] ASoC: allo-piano-dac-plus: Suppress -517 errors
|
||
|
|
||
|
Use dev_err_probe to simplify the code and suppress EPROBE_DEFER errors.
|
||
|
|
||
|
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
|
||
|
---
|
||
|
sound/soc/bcm/allo-piano-dac-plus.c | 37 ++++++++---------------------
|
||
|
1 file changed, 10 insertions(+), 27 deletions(-)
|
||
|
|
||
|
--- a/sound/soc/bcm/allo-piano-dac-plus.c
|
||
|
+++ b/sound/soc/bcm/allo-piano-dac-plus.c
|
||
|
@@ -974,48 +974,31 @@ static int snd_allo_piano_dac_probe(stru
|
||
|
|
||
|
allo_piano_2_1_codecs[0].of_node =
|
||
|
of_parse_phandle(pdev->dev.of_node, "audio-codec", 0);
|
||
|
- if (!allo_piano_2_1_codecs[0].of_node) {
|
||
|
- dev_err(&pdev->dev,
|
||
|
- "Property 'audio-codec' missing or invalid\n");
|
||
|
- return -EINVAL;
|
||
|
- }
|
||
|
-
|
||
|
allo_piano_2_1_codecs[1].of_node =
|
||
|
of_parse_phandle(pdev->dev.of_node, "audio-codec", 1);
|
||
|
- if (!allo_piano_2_1_codecs[1].of_node) {
|
||
|
- dev_err(&pdev->dev,
|
||
|
+ if (!allo_piano_2_1_codecs[0].of_node || !allo_piano_2_1_codecs[1].of_node)
|
||
|
+ return dev_err_probe(&pdev->dev, -EINVAL,
|
||
|
"Property 'audio-codec' missing or invalid\n");
|
||
|
- return -EINVAL;
|
||
|
- }
|
||
|
|
||
|
mute_gpio[0] = devm_gpiod_get_optional(&pdev->dev, "mute1",
|
||
|
GPIOD_OUT_LOW);
|
||
|
- if (IS_ERR(mute_gpio[0])) {
|
||
|
- ret = PTR_ERR(mute_gpio[0]);
|
||
|
- dev_err(&pdev->dev,
|
||
|
- "failed to get mute1 gpio6: %d\n", ret);
|
||
|
- return ret;
|
||
|
- }
|
||
|
+ if (IS_ERR(mute_gpio[0]))
|
||
|
+ return dev_err_probe(&pdev->dev, PTR_ERR(mute_gpio[0]),
|
||
|
+ "failed to get mute1 gpio\n");
|
||
|
|
||
|
mute_gpio[1] = devm_gpiod_get_optional(&pdev->dev, "mute2",
|
||
|
GPIOD_OUT_LOW);
|
||
|
- if (IS_ERR(mute_gpio[1])) {
|
||
|
- ret = PTR_ERR(mute_gpio[1]);
|
||
|
- dev_err(&pdev->dev,
|
||
|
- "failed to get mute2 gpio25: %d\n", ret);
|
||
|
- return ret;
|
||
|
- }
|
||
|
+ if (IS_ERR(mute_gpio[1]))
|
||
|
+ return dev_err_probe(&pdev->dev, PTR_ERR(mute_gpio[1]),
|
||
|
+ "failed to get mute2 gpio\n");
|
||
|
|
||
|
if (mute_gpio[0] && mute_gpio[1])
|
||
|
snd_allo_piano_dac.set_bias_level =
|
||
|
snd_allo_piano_set_bias_level;
|
||
|
|
||
|
ret = snd_soc_register_card(&snd_allo_piano_dac);
|
||
|
- if (ret < 0) {
|
||
|
- dev_err(&pdev->dev,
|
||
|
- "snd_soc_register_card() failed: %d\n", ret);
|
||
|
- return ret;
|
||
|
- }
|
||
|
+ if (ret < 0)
|
||
|
+ return dev_err_probe(&pdev->dev, ret, "snd_soc_register_card() failed\n");
|
||
|
|
||
|
if ((mute_gpio[0]) && (mute_gpio[1]))
|
||
|
snd_allo_piano_gpio_mute(&snd_allo_piano_dac);
|