From patchwork Wed Feb 27 14:40:48 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Ian King X-Patchwork-Id: 223615 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) by ozlabs.org (Postfix) with ESMTP id 3EBA22C008C for ; Thu, 28 Feb 2013 01:41:01 +1100 (EST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.76) (envelope-from ) id 1UAiBn-0002Rv-OI; Wed, 27 Feb 2013 14:40:59 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtp (Exim 4.76) (envelope-from ) id 1UAiBj-0002Qy-Of for fwts-devel@lists.ubuntu.com; Wed, 27 Feb 2013 14:40:55 +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 1UAiBj-0006LZ-M8 for fwts-devel@lists.ubuntu.com; Wed, 27 Feb 2013 14:40:55 +0000 From: Colin King To: fwts-devel@lists.ubuntu.com Subject: [PATCH 2/8] acpi: syntaxcheck: add in extra error level messages Date: Wed, 27 Feb 2013 14:40:48 +0000 Message-Id: <1361976054-28357-3-git-send-email-colin.king@canonical.com> X-Mailer: git-send-email 1.8.1.2 In-Reply-To: <1361976054-28357-1-git-send-email-colin.king@canonical.com> References: <1361976054-28357-1-git-send-email-colin.king@canonical.com> X-BeenThere: fwts-devel@lists.ubuntu.com X-Mailman-Version: 2.1.14 Precedence: list List-Id: Firmware Test Suite Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: fwts-devel-bounces@lists.ubuntu.com Sender: fwts-devel-bounces@lists.ubuntu.com From: Colin Ian King add extra error level messages and add better guarding so we don't fall off the end of the arrary. Signed-off-by: Colin Ian King Acked-by: Alex Hung Acked-by: Keng-Yu Lin --- src/acpi/syntaxcheck/syntaxcheck.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/acpi/syntaxcheck/syntaxcheck.c b/src/acpi/syntaxcheck/syntaxcheck.c index 5aee063..e4616d9 100644 --- a/src/acpi/syntaxcheck/syntaxcheck.c +++ b/src/acpi/syntaxcheck/syntaxcheck.c @@ -48,6 +48,8 @@ static void syntaxcheck_free_advice(void); #define ASL_WARNING2 1 #define ASL_WARNING3 2 #define ASL_ERROR 3 +#define ASL_REMARK 4 +#define ASL_OPTIMIZATION 5 static int syntaxcheck_init(fwts_framework *fw) { @@ -75,13 +77,14 @@ static const char *syntaxcheck_error_level(uint32_t error_code) "warning (level 1)", "warning (level 2)", "error", + "remark", + "optimization", "unknown", }; - if (error_level > 3) - error_level = 4; + const int max_levels = (sizeof(error_levels) / sizeof(char*)) - 1; - return error_levels[error_level]; + return error_levels[error_level > max_levels ? max_levels : error_level]; } /*