Skip to content

Commit 98b15e9

Browse files
pelwellpopcornmix
authored andcommitted
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 <[email protected]>
1 parent 1ce5c2f commit 98b15e9

File tree

1 file changed

+10
-27
lines changed

1 file changed

+10
-27
lines changed

sound/soc/bcm/allo-piano-dac-plus.c

+10-27
Original file line numberDiff line numberDiff line change
@@ -974,48 +974,31 @@ static int snd_allo_piano_dac_probe(struct platform_device *pdev)
974974

975975
allo_piano_2_1_codecs[0].of_node =
976976
of_parse_phandle(pdev->dev.of_node, "audio-codec", 0);
977-
if (!allo_piano_2_1_codecs[0].of_node) {
978-
dev_err(&pdev->dev,
979-
"Property 'audio-codec' missing or invalid\n");
980-
return -EINVAL;
981-
}
982-
983977
allo_piano_2_1_codecs[1].of_node =
984978
of_parse_phandle(pdev->dev.of_node, "audio-codec", 1);
985-
if (!allo_piano_2_1_codecs[1].of_node) {
986-
dev_err(&pdev->dev,
979+
if (!allo_piano_2_1_codecs[0].of_node || !allo_piano_2_1_codecs[1].of_node)
980+
return dev_err_probe(&pdev->dev, -EINVAL,
987981
"Property 'audio-codec' missing or invalid\n");
988-
return -EINVAL;
989-
}
990982

991983
mute_gpio[0] = devm_gpiod_get_optional(&pdev->dev, "mute1",
992984
GPIOD_OUT_LOW);
993-
if (IS_ERR(mute_gpio[0])) {
994-
ret = PTR_ERR(mute_gpio[0]);
995-
dev_err(&pdev->dev,
996-
"failed to get mute1 gpio6: %d\n", ret);
997-
return ret;
998-
}
985+
if (IS_ERR(mute_gpio[0]))
986+
return dev_err_probe(&pdev->dev, PTR_ERR(mute_gpio[0]),
987+
"failed to get mute1 gpio\n");
999988

1000989
mute_gpio[1] = devm_gpiod_get_optional(&pdev->dev, "mute2",
1001990
GPIOD_OUT_LOW);
1002-
if (IS_ERR(mute_gpio[1])) {
1003-
ret = PTR_ERR(mute_gpio[1]);
1004-
dev_err(&pdev->dev,
1005-
"failed to get mute2 gpio25: %d\n", ret);
1006-
return ret;
1007-
}
991+
if (IS_ERR(mute_gpio[1]))
992+
return dev_err_probe(&pdev->dev, PTR_ERR(mute_gpio[1]),
993+
"failed to get mute2 gpio\n");
1008994

1009995
if (mute_gpio[0] && mute_gpio[1])
1010996
snd_allo_piano_dac.set_bias_level =
1011997
snd_allo_piano_set_bias_level;
1012998

1013999
ret = snd_soc_register_card(&snd_allo_piano_dac);
1014-
if (ret < 0) {
1015-
dev_err(&pdev->dev,
1016-
"snd_soc_register_card() failed: %d\n", ret);
1017-
return ret;
1018-
}
1000+
if (ret < 0)
1001+
return dev_err_probe(&pdev->dev, ret, "snd_soc_register_card() failed\n");
10191002

10201003
if ((mute_gpio[0]) && (mute_gpio[1]))
10211004
snd_allo_piano_gpio_mute(&snd_allo_piano_dac);

0 commit comments

Comments
 (0)