[PATCH] acpi: method: handle ACPI failures a little more gracefully
Keng-Yu Lin
kengyu at canonical.com
Wed Dec 12 03:17:36 UTC 2012
On Sat, Dec 8, 2012 at 2:32 AM, Colin King <colin.king at canonical.com> wrote:
> From: Colin Ian King <colin.king at canonical.com>
>
> Add some improved error handling on systems that don't support ACPI.
>
> Signed-off-by: Colin Ian King <colin.king at canonical.com>
> ---
> src/acpi/method/method.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/src/acpi/method/method.c b/src/acpi/method/method.c
> index fd57015..a8669f2 100644
> --- a/src/acpi/method/method.c
> +++ b/src/acpi/method/method.c
> @@ -280,6 +280,7 @@ static int method_init(fwts_framework *fw)
> {
> fwts_acpi_table_info *info;
> int i;
> + bool got_fadt = false;
>
> fadt_mobile_platform = false;
>
> @@ -289,20 +290,23 @@ static int method_init(fwts_framework *fw)
> if (ret == FWTS_NULL_POINTER || info == NULL)
> break;
> fwts_acpi_table_fadt *fadt = (fwts_acpi_table_fadt*)info->data;
> + got_fadt = true;
> if (fadt->preferred_pm_profile == 2) {
> fadt_mobile_platform = true;
> break;
> }
> }
>
> - if (!fadt_mobile_platform) {
> + if (got_fadt && !fadt_mobile_platform) {
> fwts_log_info(fw,
> "FADT Preferred PM profile indicates this is not "
> "a Mobile Platform.");
> }
>
> - if (fwts_method_init(fw) != FWTS_OK)
> + if (fwts_method_init(fw) != FWTS_OK) {
> + fwts_log_error(fw, "Cannot initialise ACPI.");
> return FWTS_ERROR;
> + }
>
> return FWTS_OK;
> }
> --
> 1.8.0
>
Acked-by: Keng-Yu Lin <kengyu at canonical.com>
More information about the fwts-devel
mailing list