From patchwork Tue Feb 17 21:00:50 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Helgaas X-Patchwork-Id: 7675 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n1HL0tx0025935 for ; Tue, 17 Feb 2009 21:00:56 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751408AbZBQVAz (ORCPT ); Tue, 17 Feb 2009 16:00:55 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751970AbZBQVAz (ORCPT ); Tue, 17 Feb 2009 16:00:55 -0500 Received: from g1t0026.austin.hp.com ([15.216.28.33]:6275 "EHLO g1t0026.austin.hp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751408AbZBQVAy (ORCPT ); Tue, 17 Feb 2009 16:00:54 -0500 Received: from smtp2.fc.hp.com (smtp.cnd.hp.com [15.11.136.114]) by g1t0026.austin.hp.com (Postfix) with ESMTP id 006C1C229; Tue, 17 Feb 2009 21:00:53 +0000 (UTC) Received: from localhost.localdomain (lart.fc.hp.com [15.11.146.31]) by smtp2.fc.hp.com (Postfix) with ESMTP id 6A0602BC149; Tue, 17 Feb 2009 20:39:34 +0000 (UTC) Received: from bob.kio (localhost [127.0.0.1]) by localhost.localdomain (Postfix) with ESMTP id 8A51426146; Tue, 17 Feb 2009 14:00:50 -0700 (MST) From: Bjorn Helgaas Subject: [PATCH 3/4] ACPI: pci_link: remove unnecessary null pointer checks To: Len Brown Cc: linux-acpi@vger.kernel.org Date: Tue, 17 Feb 2009 14:00:50 -0700 Message-ID: <20090217210050.4506.23513.stgit@bob.kio> In-Reply-To: <20090217205906.4506.95815.stgit@bob.kio> References: <20090217205906.4506.95815.stgit@bob.kio> User-Agent: StGIT/0.14.3.215.gff3d MIME-Version: 1.0 Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org Better to oops and learn about a bug than to silently cover it up. Signed-off-by: Bjorn Helgaas --- drivers/acpi/pci_link.c | 14 +------------- 1 files changed, 1 insertions(+), 13 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/acpi/pci_link.c b/drivers/acpi/pci_link.c index b59f59e..dd9ebb9 100644 --- a/drivers/acpi/pci_link.c +++ b/drivers/acpi/pci_link.c @@ -179,9 +179,6 @@ static int acpi_pci_link_get_possible(struct acpi_pci_link *link) { acpi_status status; - if (!link) - return -EINVAL; - status = acpi_walk_resources(link->device->handle, METHOD_NAME__PRS, acpi_pci_link_check_possible, link); if (ACPI_FAILURE(status)) { @@ -259,9 +256,6 @@ static int acpi_pci_link_get_current(struct acpi_pci_link *link) acpi_status status; int irq = 0; - if (!link) - return -EINVAL; - link->irq.active = 0; /* in practice, status disabled is meaningless, ignore it */ @@ -314,7 +308,7 @@ static int acpi_pci_link_set(struct acpi_pci_link *link, int irq) } *resource; struct acpi_buffer buffer = { 0, NULL }; - if (!link || !irq) + if (!irq) return -EINVAL; resource = kzalloc(sizeof(*resource) + 1, irqs_disabled() ? GFP_ATOMIC: GFP_KERNEL); @@ -712,9 +706,6 @@ static int acpi_pci_link_add(struct acpi_device *device) int i; int found = 0; - if (!device) - return -EINVAL; - link = kzalloc(sizeof(struct acpi_pci_link), GFP_KERNEL); if (!link) return -ENOMEM; @@ -795,9 +786,6 @@ static int acpi_pci_link_remove(struct acpi_device *device, int type) { struct acpi_pci_link *link; - if (!device || !acpi_driver_data(device)) - return -EINVAL; - link = acpi_driver_data(device); mutex_lock(&acpi_link_lock);