From patchwork Wed Nov 27 13:06:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Ian King X-Patchwork-Id: 1201588 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=fwts-devel-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 47NLcc5zmRz9sTB; Thu, 28 Nov 2019 00:06:08 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1iZx1A-0001rM-11; Wed, 27 Nov 2019 13:06:04 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1iZx18-0001rG-D6 for fwts-devel@lists.ubuntu.com; Wed, 27 Nov 2019 13:06:02 +0000 Received: from 1.general.cking.uk.vpn ([10.172.193.212] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1iZx18-0002nY-6T; Wed, 27 Nov 2019 13:06:02 +0000 From: Colin King To: fwts-devel@lists.ubuntu.com Subject: [PATCH] iASL: remove unneeded NULL checks Date: Wed, 27 Nov 2019 13:06:01 +0000 Message-Id: <20191127130601.30854-1-colin.king@canonical.com> X-Mailer: git-send-email 2.24.0 MIME-Version: 1.0 X-BeenThere: fwts-devel@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Firmware Test Suite Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: fwts-devel-bounces@lists.ubuntu.com Sender: "fwts-devel" From: Erik Schmauss They are unneeded because these functions do not return NULL. In the case that these functions fail, they end up aborting the entire program rather than returning NULL. Reported-by: Colin Ian King Signed-off-by: Erik Schmauss (modified to match fwts src/acpica path) Signed-off-by: Colin Ian King Acked-by: Alex Hung Acked-by: Ivan Hu --- src/acpica/source/compiler/aslfiles.c | 6 ------ src/acpica/source/compiler/dtcompile.c | 12 +++--------- 2 files changed, 3 insertions(+), 15 deletions(-) diff --git a/src/acpica/source/compiler/aslfiles.c b/src/acpica/source/compiler/aslfiles.c index b9208c7c..23acc470 100644 --- a/src/acpica/source/compiler/aslfiles.c +++ b/src/acpica/source/compiler/aslfiles.c @@ -207,12 +207,6 @@ FlInitOneFile ( NewFileNode = ACPI_CAST_PTR (ASL_GLOBAL_FILE_NODE, UtLocalCacheCalloc (sizeof (ASL_GLOBAL_FILE_NODE))); - if (!NewFileNode) - { - AslError (ASL_ERROR, ASL_MSG_MEMORY_ALLOCATION, NULL, NULL); - return (AE_NO_MEMORY); - } - NewFileNode->ParserErrorDetected = FALSE; NewFileNode->Next = AslGbl_FilesList; diff --git a/src/acpica/source/compiler/dtcompile.c b/src/acpica/source/compiler/dtcompile.c index bdd8c1b7..80970822 100644 --- a/src/acpica/source/compiler/dtcompile.c +++ b/src/acpica/source/compiler/dtcompile.c @@ -276,10 +276,7 @@ DtDoCompile ( if (ACPI_FAILURE (Status)) { - if (FileNode) - { - FileNode->ParserErrorDetected = TRUE; - } + FileNode->ParserErrorDetected = TRUE; /* TBD: temporary error message. Msgs should come from function above */ @@ -306,11 +303,8 @@ DtDoCompile ( /* Save the compile time statistics to the current file node */ - if (FileNode) - { - FileNode->TotalFields = AslGbl_InputFieldCount; - FileNode->OutputByteLength = AslGbl_TableLength; - } + FileNode->TotalFields = AslGbl_InputFieldCount; + FileNode->OutputByteLength = AslGbl_TableLength; return (Status); }