Skip to contentSkip to conversation

ASoC: amd: yc: Fix the wrong return value

PATCH Superseded Venkata Prasad Potturu 3 participants 6 messages Dec 9, 2024 – Dec 10, 2024

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Venkata Prasad Potturu

author reviewer
#0 lore raw

PATCH 1/1 ASoC: amd: yc: Fix the wrong return value

With the current implementation, when ACP driver fails to read ACPI _WOV entry then the DMI overrides code won't invoke, may cause regressions for some BIOS versions.

Add a condition check to jump to check the DMI entries incase of ACP driver fail to read ACPI _WOV method.

Fixes 4095cf872084 (ASoC: amd: yc: Fix for enabling DMIC on acp6x via _DSD entry)
---
 sound/soc/amd/yc/acp6x-mach.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
sound/soc/amd/yc/acp6x-mach.c +8 -3
index e38c5885dadf..13af1d485eb0 100644
@@ -578,14 +578,19 @@ static int acp6x_probe(struct platform_device *pdev)
 
 	handle = ACPI_HANDLE(pdev->dev.parent);
 	ret = acpi_evaluate_integer(handle, "_WOV", NULL, &dmic_status);
-	if (!ACPI_FAILURE(ret))
+	if (!ACPI_FAILURE(ret)) {
 		wov_en = dmic_status;
+		if (!wov_en)
+			return -ENODEV;
+	} else {
+		/* Incase of ACPI method read failure then jump to check_dmi_entry */
+		goto check_dmi_entry;
+	}
 
 	if (is_dmic_enable && wov_en)
 		platform_set_drvdata(pdev, &acp6x_card);
-	else
-		return 0;
 
+check_dmi_entry:
 	/* check for any DMI overrides */
 	dmi_id = dmi_first_match(yc_acp_quirk_table);
 	if (dmi_id)
Signature · 1 line
2.25.1
#1 lore raw

…

Quoted 2 lines

Add a condition check to jump to check the DMI entries incase of ACP driver fail to read ACPI _WOV method.

in case? failure?

…

Quoted 7 lines

+++ b/sound/soc/amd/yc/acp6x-mach.c

sound/soc/amd/yc/acp6x-mach.c +1 -1
@@ -578,14 +578,19 @@ static int acp6x_probe(struct platform_device *pdev)
 
 	handle = ACPI_HANDLE(pdev->dev.parent);
 	ret = acpi_evaluate_integer(handle, "_WOV", NULL, &dmic_status);
-	if (!ACPI_FAILURE(ret))
+	if (!ACPI_FAILURE(ret)) {

sound/soc/amd/yc/acp6x-mach.c static int acp6x_probe(struct platform_device *pdev) · line 591

Quoted 10 lines
sound/soc/amd/yc/acp6x-mach.c +6 -0
 		wov_en = dmic_status;
+		if (!wov_en)
+			return -ENODEV;
+	} else {
+		/* Incase of ACPI method read failure then jump to check_dmi_entry */
+		goto check_dmi_entry;
+	}
 
 	if (is_dmic_enable && wov_en)
 		platform_set_drvdata(pdev, &acp6x_card);

…

Is there a need to adjust another condition check accordingly?

Regards,
Markus

author reviewer
#2 lore raw

On 12/9/24 19:16, Markus Elfring wrote:
Hi Markus,

Quoted 4 lines

…

Quoted 2 lines

Add a condition check to jump to check the DMI entries incase of ACP driver fail to read ACPI _WOV method.

in case? failure?

It's a continuous statement.
"Added a condition check to jump into check_dmi_entry when ACP driver fail to read ACPI _WOV method".

Quoted 18 lines

…

Quoted 15 lines

+++ b/sound/soc/amd/yc/acp6x-mach.c

sound/soc/amd/yc/acp6x-mach.c +7 -1
@@ -578,14 +578,19 @@ static int acp6x_probe(struct platform_device *pdev)
 
  	handle = ACPI_HANDLE(pdev->dev.parent);
  	ret = acpi_evaluate_integer(handle, "_WOV", NULL, &dmic_status);
-	if (!ACPI_FAILURE(ret))
+	if (!ACPI_FAILURE(ret)) {
  		wov_en = dmic_status;
+		if (!wov_en)
+			return -ENODEV;
+	} else {
+		/* Incase of ACPI method read failure then jump to check_dmi_entry */
+		goto check_dmi_entry;
+	}
 
Quoted 5 lines

sound/soc/amd/yc/acp6x-mach.c static int acp6x_probe(struct platform_device *pdev) · line 591

Quoted 2 lines
sound/soc/amd/yc/acp6x-mach.c +0 -0
  	if (is_dmic_enable && wov_en)
  		platform_set_drvdata(pdev, &acp6x_card);

…

Is there a need to adjust another condition check accordingly?

No Markus, not required.

Quoted 3 lines

Regards,
Markus

#3 lore raw
Quoted 16 lines
Quoted 16 lines

…

Quoted 15 lines

+++ b/sound/soc/amd/yc/acp6x-mach.c

sound/soc/amd/yc/acp6x-mach.c +7 -1
@@ -578,14 +578,19 @@ static int acp6x_probe(struct platform_device *pdev)
 
       handle = ACPI_HANDLE(pdev->dev.parent);
       ret = acpi_evaluate_integer(handle, "_WOV", NULL, &dmic_status);
-    if (!ACPI_FAILURE(ret))
+    if (!ACPI_FAILURE(ret)) {
           wov_en = dmic_status;
+        if (!wov_en)
+            return -ENODEV;
+    } else {
+        /* Incase of ACPI method read failure then jump to check_dmi_entry */
+        goto check_dmi_entry;
+    }
 
Quoted 6 lines
Quoted 5 lines

sound/soc/amd/yc/acp6x-mach.c static int acp6x_probe(struct platform_device *pdev) · line 591

Quoted 2 lines
sound/soc/amd/yc/acp6x-mach.c +0 -0
       if (is_dmic_enable && wov_en)
           platform_set_drvdata(pdev, &acp6x_card);

…

Is there a need to adjust another condition check accordingly?

No Markus, not required.

Can it be that the expression part “&& wov_en” became redundant with the proposed source code adjustment?

Regards,
Markus

author reviewer
#4 lore raw
Quoted 16 lines · Markus Elfring
Quoted 16 lines
Quoted 16 lines

…

Quoted 15 lines

+++ b/sound/soc/amd/yc/acp6x-mach.c

sound/soc/amd/yc/acp6x-mach.c +7 -1
@@ -578,14 +578,19 @@ static int acp6x_probe(struct platform_device *pdev)
 
       handle = ACPI_HANDLE(pdev->dev.parent);
       ret = acpi_evaluate_integer(handle, "_WOV", NULL, &dmic_status);
-    if (!ACPI_FAILURE(ret))
+    if (!ACPI_FAILURE(ret)) {
           wov_en = dmic_status;
+        if (!wov_en)
+            return -ENODEV;
+    } else {
+        /* Incase of ACPI method read failure then jump to check_dmi_entry */
+        goto check_dmi_entry;
+    }
 
Quoted 8 lines
Quoted 6 lines
Quoted 5 lines

sound/soc/amd/yc/acp6x-mach.c static int acp6x_probe(struct platform_device *pdev) · line 591

Quoted 2 lines
sound/soc/amd/yc/acp6x-mach.c +0 -0
       if (is_dmic_enable && wov_en)
           platform_set_drvdata(pdev, &acp6x_card);

…

Is there a need to adjust another condition check accordingly?

No Markus, not required.

Can it be that the expression part “&& wov_en” became redundant with the proposed source code adjustment?

Agreed, will remove && wov_en  and then send v2 patch.

Quoted 3 lines

Regards,
Markus

maintainer
#5 lore raw
In reply to Venkata Prasad Potturu
Quoted 8 lines · Venkata Prasad Potturu

With the current implementation, when ACP driver fails to read ACPI _WOV entry then the DMI overrides code won't invoke, may cause regressions for some BIOS versions.

Add a condition check to jump to check the DMI entries incase of ACP driver fail to read ACPI _WOV method.

[...]

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/1] ASoC: amd: yc: Fix the wrong return value

      commit: 984795e76def5c903724b8d6a8228e356bbdf2af

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark