From patchwork Thu Dec 6 18:27:50 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: acpi: fadt: only perform port read on valid port widths Date: Thu, 06 Dec 2012 08:27:50 -0000 From: Colin King X-Patchwork-Id: 204299 Message-Id: <1354818470-20979-1-git-send-email-colin.king@canonical.com> To: fwts-devel@lists.ubuntu.com From: Colin Ian King Only peform ioperm() and port read when we have a valid port width specified. Signed-off-by: Colin Ian King Acked-by: Keng-Yu Lin Acked-by: Alex Hung --- 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);