[PATCH] acpi: fadt: only perform port read on valid port widths
Keng-Yu Lin
kengyu at canonical.com
Mon Dec 10 07:16:08 UTC 2012
On Fri, Dec 7, 2012 at 2:27 AM, Colin King <colin.king at canonical.com> wrote:
> From: Colin Ian King <colin.king at canonical.com>
>
> Only peform ioperm() and port read when we have a valid port
> width specified.
>
> Signed-off-by: Colin Ian King <colin.king at canonical.com>
> ---
> src/acpi/fadt/fadt.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/src/acpi/fadt/fadt.c b/src/acpi/fadt/fadt.c
> index e14d7be..2114b42 100644
> --- a/src/acpi/fadt/fadt.c
> +++ b/src/acpi/fadt/fadt.c
> @@ -92,22 +92,23 @@ static int fadt_test1(fwts_framework *fw)
> width = fadt->x_pm1a_cnt_blk.register_bit_width;
> }
>
> - ioperm(port, width/8, 1);
> switch (width) {
> case 8:
> + ioperm(port, width/8, 1);
> value = inb(fadt->pm1a_cnt_blk);
> ioperm(port, width/8, 0);
> break;
> case 16:
> + ioperm(port, width/8, 1);
> value = inw(fadt->pm1a_cnt_blk);
> ioperm(port, width/8, 0);
> break;
> case 32:
> + ioperm(port, width/8, 1);
> value = inl(fadt->pm1a_cnt_blk);
> ioperm(port, width/8, 0);
> break;
> default:
> - ioperm(port, width/8, 0);
> fwts_failed(fw, LOG_LEVEL_HIGH, "FADTPM1AInvalidWidth",
> "FADT pm1a register has invalid bit width of %d.",
> width);
> --
> 1.8.0
>
Acked-by: Keng-Yu Lin <kengyu at canonical.com>
More information about the fwts-devel
mailing list