public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
From: Bjorn Helgaas <bjorn.helgaas@hp.com>
To: Len Brown <lenb@kernel.org>
Cc: linux-acpi@vger.kernel.org
Subject: [PATCH 3/4] ACPI: pci_link: remove unnecessary null pointer checks
Date: Tue, 17 Feb 2009 14:00:50 -0700	[thread overview]
Message-ID: <20090217210050.4506.23513.stgit@bob.kio> (raw)
In-Reply-To: <20090217205906.4506.95815.stgit@bob.kio>

Better to oops and learn about a bug than to silently cover it up.

Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
---
 drivers/acpi/pci_link.c |   14 +-------------
 1 files changed, 1 insertions(+), 13 deletions(-)

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);


  parent reply	other threads:[~2009-02-17 21:00 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-17 21:00 [PATCH 0/4] ACPI: pci_link cleanups Bjorn Helgaas
2009-02-17 21:00 ` [PATCH 1/4] ACPI: pci_link: clean up whitespace Bjorn Helgaas
2009-03-17  5:54   ` Len Brown
2009-02-17 21:00 ` [PATCH 2/4] ACPI: pci_link: remove unnecessary casts and initializations Bjorn Helgaas
2009-03-17  5:54   ` Len Brown
2009-02-17 21:00 ` Bjorn Helgaas [this message]
2009-03-17  5:54   ` [PATCH 3/4] ACPI: pci_link: remove unnecessary null pointer checks Len Brown
2009-02-17 21:00 ` [PATCH 4/4] ACPI: pci_link: simplify list of link devices Bjorn Helgaas
2009-03-17  5:54   ` Len Brown
2009-03-12 22:52 ` [PATCH 0/4] ACPI: pci_link cleanups Bjorn Helgaas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090217210050.4506.23513.stgit@bob.kio \
    --to=bjorn.helgaas@hp.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox