From patchwork Thu Feb 5 09:33:14 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hanjun Guo X-Patchwork-Id: 44412 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f200.google.com (mail-wi0-f200.google.com [209.85.212.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id A217321521 for ; Thu, 5 Feb 2015 09:39:43 +0000 (UTC) Received: by mail-wi0-f200.google.com with SMTP id fb4sf5555169wid.3 for ; Thu, 05 Feb 2015 01:39:42 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=TyT4xqQ73MDwR8UmhZjFiy+BDaMG4epBNwpX4Psa/VM=; b=M6vj9yHH7laMjibu/N6eAWVQNNKwz9qIWTcMUiQ6Q8VvrOLK8nUx7LMWURlByyyG64 GP8UGgGBpeaq2FN57PaYgdmp4RSgiYvhtSAy3VZCfHG/qPPNnSyEYAwOsH9662j3ryLr zZ0ZX57HBv3iNYmrZQ+BgoGC7EXZ7UvfiZP8rEQQ8mVOBIo8bBvRDvtNKO6NKT7T418s f3e3VPxGl28HyVBbiJykqB2r6qyrpSGTa0Z6BYCypeAGn4LoOxseKBmy8DHRlTf7tooZ 36hGhNI+cyFynxPfMNYerN6nvq9Ohrl7lVYaXmARG/L+4m71m6FUlSsJQBa6t2tnxH0q 5oOA== X-Gm-Message-State: ALoCoQmXkaO/o0QGYPsLgBcT3AvrIMdZDk2yKrQhMW/5DbQFScLyQmKfdOLewVrP33jBjfSy0dLb X-Received: by 10.152.43.166 with SMTP id x6mr335963lal.3.1423129182881; Thu, 05 Feb 2015 01:39:42 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.87.65 with SMTP id v1ls36056laz.61.gmail; Thu, 05 Feb 2015 01:39:42 -0800 (PST) X-Received: by 10.112.159.195 with SMTP id xe3mr2420809lbb.64.1423129182737; Thu, 05 Feb 2015 01:39:42 -0800 (PST) Received: from mail-la0-f52.google.com (mail-la0-f52.google.com. [209.85.215.52]) by mx.google.com with ESMTPS id pf5si3470026lbc.94.2015.02.05.01.39.42 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 05 Feb 2015 01:39:42 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.52 as permitted sender) client-ip=209.85.215.52; Received: by mail-la0-f52.google.com with SMTP id gd6so4962394lab.11 for ; Thu, 05 Feb 2015 01:39:42 -0800 (PST) X-Received: by 10.112.135.196 with SMTP id pu4mr2368002lbb.41.1423129182325; Thu, 05 Feb 2015 01:39:42 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.35.133 with SMTP id h5csp1026964lbj; Thu, 5 Feb 2015 01:39:41 -0800 (PST) X-Received: by 10.68.240.233 with SMTP id wd9mr4182120pbc.69.1423128825166; Thu, 05 Feb 2015 01:33:45 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g3si5479984pat.95.2015.02.05.01.33.43; Thu, 05 Feb 2015 01:33:45 -0800 (PST) Received-SPF: none (google.com: linux-acpi-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755960AbbBEJdm (ORCPT + 7 others); Thu, 5 Feb 2015 04:33:42 -0500 Received: from mail-pd0-f172.google.com ([209.85.192.172]:38367 "EHLO mail-pd0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753268AbbBEJdl (ORCPT ); Thu, 5 Feb 2015 04:33:41 -0500 Received: by pdbft15 with SMTP id ft15so6722843pdb.5 for ; Thu, 05 Feb 2015 01:33:41 -0800 (PST) X-Received: by 10.70.140.6 with SMTP id rc6mr4272133pdb.144.1423128820901; Thu, 05 Feb 2015 01:33:40 -0800 (PST) Received: from localhost ([180.150.148.224]) by mx.google.com with ESMTPSA id nw6sm4434437pbb.94.2015.02.05.01.33.39 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 05 Feb 2015 01:33:40 -0800 (PST) From: Hanjun Guo To: "Rafael J. Wysocki" Cc: Lorenzo Pieralisi , linux-acpi@vger.kernel.org, linaro-acpi@lists.linaro.org, Hanjun Guo , Tony Luck , Thomas Gleixner Subject: [PATCH] ACPI / table: remove duplicate NULL check for the handler of acpi_table_parse() Date: Thu, 5 Feb 2015 17:33:14 +0800 Message-Id: <1423128794-4680-1-git-send-email-hanjun.guo@linaro.org> X-Mailer: git-send-email 1.9.1 Sender: linux-acpi-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: hanjun.guo@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.52 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , In acpi_table_parse(), pointer of the table to pass to handler() is checked before handler() called, so remove all the duplicate NULL check in the handler function. CC: Tony Luck CC: Thomas Gleixner Signed-off-by: Hanjun Guo --- arch/ia64/kernel/acpi.c | 6 ------ arch/x86/kernel/acpi/boot.c | 16 ++-------------- drivers/acpi/numa.c | 12 ++---------- 3 files changed, 4 insertions(+), 30 deletions(-) diff --git a/arch/ia64/kernel/acpi.c b/arch/ia64/kernel/acpi.c index e795cb8..2c44989 100644 --- a/arch/ia64/kernel/acpi.c +++ b/arch/ia64/kernel/acpi.c @@ -380,9 +380,6 @@ static void __init acpi_madt_oem_check(char *oem_id, char *oem_table_id) static int __init acpi_parse_madt(struct acpi_table_header *table) { - if (!table) - return -EINVAL; - acpi_madt = (struct acpi_table_madt *)table; acpi_madt_rev = acpi_madt->header.revision; @@ -645,9 +642,6 @@ static int __init acpi_parse_fadt(struct acpi_table_header *table) struct acpi_table_header *fadt_header; struct acpi_table_fadt *fadt; - if (!table) - return -EINVAL; - fadt_header = (struct acpi_table_header *)table; if (fadt_header->revision != 3) return -ENODEV; /* Only deal with ACPI 2.0 FADT */ diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c index b9e30da..14d3652 100644 --- a/arch/x86/kernel/acpi/boot.c +++ b/arch/x86/kernel/acpi/boot.c @@ -843,13 +843,7 @@ int acpi_ioapic_registered(acpi_handle handle, u32 gsi_base) static int __init acpi_parse_sbf(struct acpi_table_header *table) { - struct acpi_table_boot *sb; - - sb = (struct acpi_table_boot *)table; - if (!sb) { - printk(KERN_WARNING PREFIX "Unable to map SBF\n"); - return -ENODEV; - } + struct acpi_table_boot *sb = (struct acpi_table_boot *)table; sbf_port = sb->cmos_index; /* Save CMOS port */ @@ -863,13 +857,7 @@ static struct resource *hpet_res __initdata; static int __init acpi_parse_hpet(struct acpi_table_header *table) { - struct acpi_table_hpet *hpet_tbl; - - hpet_tbl = (struct acpi_table_hpet *)table; - if (!hpet_tbl) { - printk(KERN_WARNING PREFIX "Unable to map HPET\n"); - return -ENODEV; - } + struct acpi_table_hpet *hpet_tbl = (struct acpi_table_hpet *)table; if (hpet_tbl->address.space_id != ACPI_SPACE_MEM) { printk(KERN_WARNING PREFIX "HPET timers must be located in " diff --git a/drivers/acpi/numa.c b/drivers/acpi/numa.c index 24b5476..1333cbdc 100644 --- a/drivers/acpi/numa.c +++ b/drivers/acpi/numa.c @@ -177,12 +177,7 @@ static int __init slit_valid(struct acpi_table_slit *slit) static int __init acpi_parse_slit(struct acpi_table_header *table) { - struct acpi_table_slit *slit; - - if (!table) - return -EINVAL; - - slit = (struct acpi_table_slit *)table; + struct acpi_table_slit *slit = (struct acpi_table_slit *)table; if (!slit_valid(slit)) { printk(KERN_INFO "ACPI: SLIT table looks invalid. Not used.\n"); @@ -260,11 +255,8 @@ acpi_parse_memory_affinity(struct acpi_subtable_header * header, static int __init acpi_parse_srat(struct acpi_table_header *table) { - struct acpi_table_srat *srat; - if (!table) - return -EINVAL; + struct acpi_table_srat *srat = (struct acpi_table_srat *)table; - srat = (struct acpi_table_srat *)table; acpi_srat_revision = srat->header.revision; /* Real work done in acpi_table_parse_srat below. */