diff mbox series

[03/11] ASoC: amd: acp: Add missing error handling in sof-mach

Message ID 20231209205351.880797-4-cristian.ciocaltea@collabora.com (mailing list archive)
State Superseded
Headers show
Series Improve SOF support for Steam Deck OLED | expand

Commit Message

Cristian Ciocaltea Dec. 9, 2023, 8:53 p.m. UTC
Handle potential acp_sofdsp_dai_links_create() errors in ACP SOF machine
driver's probe function.  Additionally, switch to dev_err_probe().

Fixes: 9f84940f5004 ("ASoC: amd: acp: Add SOF audio support on Chrome board")
Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
---
 sound/soc/amd/acp/acp-sof-mach.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

Comments

Emil Velikov Dec. 11, 2023, 1:31 p.m. UTC | #1
On 2023/12/09, Cristian Ciocaltea wrote:
> Handle potential acp_sofdsp_dai_links_create() errors in ACP SOF machine
> driver's probe function.  Additionally, switch to dev_err_probe().
> 
> Fixes: 9f84940f5004 ("ASoC: amd: acp: Add SOF audio support on Chrome board")
> Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
> ---
>  sound/soc/amd/acp/acp-sof-mach.c | 14 ++++++--------
>  1 file changed, 6 insertions(+), 8 deletions(-)
> 
> diff --git a/sound/soc/amd/acp/acp-sof-mach.c b/sound/soc/amd/acp/acp-sof-mach.c
> index 1d313fcb5f2d..6f0ca23638af 100644
> --- a/sound/soc/amd/acp/acp-sof-mach.c
> +++ b/sound/soc/amd/acp/acp-sof-mach.c
> @@ -112,16 +112,14 @@ static int acp_sof_probe(struct platform_device *pdev)
>  	if (dmi_id && dmi_id->driver_data)
>  		acp_card_drvdata->tdm_mode = dmi_id->driver_data;
>  
> -	acp_sofdsp_dai_links_create(card);
> +	ret = acp_sofdsp_dai_links_create(card);
> +	if (ret)
> +		return dev_err_probe(&pdev->dev, ret, "Failed to create DAI links\n");
>  
>  	ret = devm_snd_soc_register_card(&pdev->dev, card);
> -	if (ret) {
> -		dev_err(&pdev->dev,
> -				"devm_snd_soc_register_card(%s) failed: %d\n",
> -				card->name, ret);
> -		return ret;
> -	}
> -
> +	if (ret)

Do we need to undo acp_sofdsp_dai_links_create() in here? If not, please
add a trivial note in the commit message.

With that the series is:
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>

HTH o/
-Emil
Cristian Ciocaltea Dec. 11, 2023, 4:56 p.m. UTC | #2
On 12/11/23 15:31, Emil Velikov wrote:
> On 2023/12/09, Cristian Ciocaltea wrote:
>> Handle potential acp_sofdsp_dai_links_create() errors in ACP SOF machine
>> driver's probe function.  Additionally, switch to dev_err_probe().
>>
>> Fixes: 9f84940f5004 ("ASoC: amd: acp: Add SOF audio support on Chrome board")
>> Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
>> ---
>>  sound/soc/amd/acp/acp-sof-mach.c | 14 ++++++--------
>>  1 file changed, 6 insertions(+), 8 deletions(-)
>>
>> diff --git a/sound/soc/amd/acp/acp-sof-mach.c b/sound/soc/amd/acp/acp-sof-mach.c
>> index 1d313fcb5f2d..6f0ca23638af 100644
>> --- a/sound/soc/amd/acp/acp-sof-mach.c
>> +++ b/sound/soc/amd/acp/acp-sof-mach.c
>> @@ -112,16 +112,14 @@ static int acp_sof_probe(struct platform_device *pdev)
>>  	if (dmi_id && dmi_id->driver_data)
>>  		acp_card_drvdata->tdm_mode = dmi_id->driver_data;
>>  
>> -	acp_sofdsp_dai_links_create(card);
>> +	ret = acp_sofdsp_dai_links_create(card);
>> +	if (ret)
>> +		return dev_err_probe(&pdev->dev, ret, "Failed to create DAI links\n");
>>  
>>  	ret = devm_snd_soc_register_card(&pdev->dev, card);
>> -	if (ret) {
>> -		dev_err(&pdev->dev,
>> -				"devm_snd_soc_register_card(%s) failed: %d\n",
>> -				card->name, ret);
>> -		return ret;
>> -	}
>> -
>> +	if (ret)
> 
> Do we need to undo acp_sofdsp_dai_links_create() in here? If not, please
> add a trivial note in the commit message.

No need to undo, will update the commit as suggested.

> With that the series is:
> Reviewed-by: Emil Velikov <emil.velikov@collabora.com>

Thanks for reviewing,
Cristian

> HTH o/
> -Emil
diff mbox series

Patch

diff --git a/sound/soc/amd/acp/acp-sof-mach.c b/sound/soc/amd/acp/acp-sof-mach.c
index 1d313fcb5f2d..6f0ca23638af 100644
--- a/sound/soc/amd/acp/acp-sof-mach.c
+++ b/sound/soc/amd/acp/acp-sof-mach.c
@@ -112,16 +112,14 @@  static int acp_sof_probe(struct platform_device *pdev)
 	if (dmi_id && dmi_id->driver_data)
 		acp_card_drvdata->tdm_mode = dmi_id->driver_data;
 
-	acp_sofdsp_dai_links_create(card);
+	ret = acp_sofdsp_dai_links_create(card);
+	if (ret)
+		return dev_err_probe(&pdev->dev, ret, "Failed to create DAI links\n");
 
 	ret = devm_snd_soc_register_card(&pdev->dev, card);
-	if (ret) {
-		dev_err(&pdev->dev,
-				"devm_snd_soc_register_card(%s) failed: %d\n",
-				card->name, ret);
-		return ret;
-	}
-
+	if (ret)
+		return dev_err_probe(&pdev->dev, ret,
+				     "Failed to register card(%s)\n", card->name);
 	return 0;
 }