From patchwork Thu Dec 6 18:27:50 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Ian King X-Patchwork-Id: 204299 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from chlorine.canonical.com (chlorine.canonical.com [91.189.94.204]) by ozlabs.org (Postfix) with ESMTP id A41FF2C00B9 for ; Fri, 7 Dec 2012 05:27:53 +1100 (EST) Received: from localhost ([127.0.0.1] helo=chlorine.canonical.com) by chlorine.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1TggAq-00054J-Dx; Thu, 06 Dec 2012 18:27:52 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by chlorine.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1TggAo-00054E-Q8 for fwts-devel@lists.ubuntu.com; Thu, 06 Dec 2012 18:27:50 +0000 Received: from cpc3-craw6-2-0-cust180.croy.cable.virginmedia.com ([77.100.248.181] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1TggAo-0004Pd-Ne for fwts-devel@lists.ubuntu.com; Thu, 06 Dec 2012 18:27:50 +0000 From: Colin King To: fwts-devel@lists.ubuntu.com Subject: [PATCH] acpi: fadt: only perform port read on valid port widths Date: Thu, 6 Dec 2012 18:27:50 +0000 Message-Id: <1354818470-20979-1-git-send-email-colin.king@canonical.com> X-Mailer: git-send-email 1.8.0 X-BeenThere: fwts-devel@lists.ubuntu.com X-Mailman-Version: 2.1.13 Precedence: list List-Id: Firmware Test Suite Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: fwts-devel-bounces@lists.ubuntu.com Errors-To: fwts-devel-bounces@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);