Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp599773ybz; Fri, 24 Apr 2020 06:10:15 -0700 (PDT) X-Google-Smtp-Source: APiQypKu3vGgJTw7GbOH7s9CQrQH7cMyuVXVAJHlfFVpSZvTQR+Wg7H+5MPiGGZU60lW8snXzeSW X-Received: by 2002:a50:e806:: with SMTP id e6mr7364819edn.153.1587733814930; Fri, 24 Apr 2020 06:10:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587733814; cv=none; d=google.com; s=arc-20160816; b=VvykH2FJM8EApRvoUhUAKnuH/cYknzNbDj/lDoZTXdSV2aU3PJhJTMsx/BEBU20l8E kRekNAHyfukqo4jI4ws4hANBBiY7djwPAv97+gM72Goc6xkks8EcKdDcDl1/608W0Q2C RPA0ybGoPh1P+BczElDq7Eshs24iEZKHKviJ7ofoM/d/P+wSIDlwTq3rf4uLgZXywmX3 9HDz/4gCgUeLDwtg5kb47nISdOGn9XJJ3P3YyZQ+m5XfRgwblM09MXVS8xXlZ/b0kDD+ 2XJF5uTYVxGrmae8PTLRn7r47zCFuP/nWB+0oWln8S70sVPj7FRgv5F8s8K8P5kYOYnr Ghzg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=RxOrFN9SbgcYmuQKhYf4fqQlxNfN/EIFCkuUJXrBt1M=; b=JL+JLrSTyra+hmG85EszvcnKWSpf8x4Svw4NOFAjgQ4RLI4kTuLVU3ye5RX+81OLAR JZO/TMuSr17tBVvZae6XdyYkugcTGh+V/iY7MR1bpRk+QLRSprRs3dZSyvQiRmGxmhNe LvBvyIYwyX0NuKjx76xaFixHUqdusc3/+05u6zD0rFcPEDGPUG/0Zg4apRWT6Kty4Kfk NuyOMKNJj7dR2E/nPMPG+0fozJd8BSn6mE7HXhcIPiZOpXxtH6om5auPNZzkX80lIbQi aE7doJ4F7Sr0ZLJ+dMB5cG0CnojLaGOyqrwL1DyupSsJfPe4YASVrV4U2hbGyJd9LE/3 za/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=sYFlRO6j; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s29si3123087edi.340.2020.04.24.06.09.47; Fri, 24 Apr 2020 06:10:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=sYFlRO6j; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728350AbgDXNH0 (ORCPT + 99 others); Fri, 24 Apr 2020 09:07:26 -0400 Received: from mail.kernel.org ([198.145.29.99]:58160 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728349AbgDXNHY (ORCPT ); Fri, 24 Apr 2020 09:07:24 -0400 Received: from e123331-lin.home (amontpellier-657-1-18-247.w109-210.abo.wanadoo.fr [109.210.65.247]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E4DB82084D; Fri, 24 Apr 2020 13:07:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1587733643; bh=rspLT0jEFuKk+8InswzVszPuHwWF31+D+jC6L7vwmz4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sYFlRO6jWEY3RG+Kv0wINRYb/ec4eP7uzJIq0tAy0RmMFoPHeAI2kxKJChwADxCoj Lugi496iid7DBICoC+stgTEpiaWC9TkE6yzy6gedmR5h+90t43VFeA8QesiNc5nxgd Evp5Ln89iaNOTMM7jQu52O5QlhOBrL5WqnTFMG0c= From: Ard Biesheuvel To: linux-efi@vger.kernel.org, Ingo Molnar , Thomas Gleixner Cc: Ard Biesheuvel , linux-kernel@vger.kernel.org, Arvind Sankar , Atish Patra , Palmer Dabbelt , Zou Wei Subject: [PATCH 33/33] efi: Move arch_tables check to caller Date: Fri, 24 Apr 2020 15:05:31 +0200 Message-Id: <20200424130531.30518-34-ardb@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200424130531.30518-1-ardb@kernel.org> References: <20200424130531.30518-1-ardb@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Instead of making match_config_table() test its table_types pointer for NULL-ness, omit the call entirely if no arch_tables pointer was provided to efi_config_parse_tables(). Signed-off-by: Ard Biesheuvel --- drivers/firmware/efi/efi.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c index e49c0b6db988..48d0188936c3 100644 --- a/drivers/firmware/efi/efi.c +++ b/drivers/firmware/efi/efi.c @@ -525,15 +525,13 @@ static __init int match_config_table(const efi_guid_t *guid, { int i; - if (table_types) { - for (i = 0; efi_guidcmp(table_types[i].guid, NULL_GUID); i++) { - if (!efi_guidcmp(*guid, table_types[i].guid)) { - *(table_types[i].ptr) = table; - if (table_types[i].name[0]) - pr_cont(" %s=0x%lx ", - table_types[i].name, table); - return 1; - } + for (i = 0; efi_guidcmp(table_types[i].guid, NULL_GUID); i++) { + if (!efi_guidcmp(*guid, table_types[i].guid)) { + *(table_types[i].ptr) = table; + if (table_types[i].name[0]) + pr_cont("%s=0x%lx ", + table_types[i].name, table); + return 1; } } @@ -570,7 +568,7 @@ int __init efi_config_parse_tables(const efi_config_table_t *config_tables, table = tbl32[i].table; } - if (!match_config_table(guid, table, common_tables)) + if (!match_config_table(guid, table, common_tables) && arch_tables) match_config_table(guid, table, arch_tables); } pr_cont("\n"); -- 2.17.1