diff mbox series

[v2,1/2] lib: fwts_acpi_object_eval: Do not return FWTS_OK if method lookup fails

Message ID 20241011214009.28540-1-W_Armin@gmx.de
State Accepted
Headers show
Series [v2,1/2] lib: fwts_acpi_object_eval: Do not return FWTS_OK if method lookup fails | expand

Commit Message

Armin Wolf Oct. 11, 2024, 9:40 p.m. UTC
If for some reason the lookup of an ACPI method fails with an error
different than AE_NOT_FOUND, FWTS_OK is returned.

Fix this by instead returning FWTS_ERROR in such cases.

Signed-off-by: Armin Wolf <W_Armin@gmx.de>
---
 src/lib/src/fwts_acpi_object_eval.c | 7 +++++++
 1 file changed, 7 insertions(+)

--
2.39.5

Comments

ivanhu Oct. 17, 2024, 3:53 a.m. UTC | #1
Acked-by: Ivan Hu <ivan.hu@canonical.com>

On 2024/10/12 05:40, Armin Wolf wrote:
> If for some reason the lookup of an ACPI method fails with an error
> different than AE_NOT_FOUND, FWTS_OK is returned.
> 
> Fix this by instead returning FWTS_ERROR in such cases.
> 
> Signed-off-by: Armin Wolf <W_Armin@gmx.de>
> ---
>   src/lib/src/fwts_acpi_object_eval.c | 7 +++++++
>   1 file changed, 7 insertions(+)
> 
> diff --git a/src/lib/src/fwts_acpi_object_eval.c b/src/lib/src/fwts_acpi_object_eval.c
> index 37f67eb8..1c2de735 100644
> --- a/src/lib/src/fwts_acpi_object_eval.c
> +++ b/src/lib/src/fwts_acpi_object_eval.c
> @@ -1222,6 +1222,13 @@ int fwts_evaluate_method(fwts_framework *fw,
>   		}
>   	}
> 
> +	if (ACPI_FAILURE(status)) {
> +		const char *exception = AcpiFormatException(status);
> +		fwts_log_info(fw, "ACPICA Exception %s during lookup of method %s",
> +			      exception, name);
> +		return FWTS_ERROR;
> +	}
> +
>   	return FWTS_OK;
>   }
> 
> --
> 2.39.5
>
diff mbox series

Patch

diff --git a/src/lib/src/fwts_acpi_object_eval.c b/src/lib/src/fwts_acpi_object_eval.c
index 37f67eb8..1c2de735 100644
--- a/src/lib/src/fwts_acpi_object_eval.c
+++ b/src/lib/src/fwts_acpi_object_eval.c
@@ -1222,6 +1222,13 @@  int fwts_evaluate_method(fwts_framework *fw,
 		}
 	}

+	if (ACPI_FAILURE(status)) {
+		const char *exception = AcpiFormatException(status);
+		fwts_log_info(fw, "ACPICA Exception %s during lookup of method %s",
+			      exception, name);
+		return FWTS_ERROR;
+	}
+
 	return FWTS_OK;
 }