public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
From: Bjorn Helgaas <bjorn.helgaas-VXdhtT5mjnY@public.gmane.org>
To: Len Brown <len.brown-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
	acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
Subject: [PATCH] Fix _STA checking in acpi_bus_add
Date: Fri, 2 Jan 2004 16:35:25 -0700	[thread overview]
Message-ID: <200401021635.25419.bjorn.helgaas@hp.com> (raw)

In 2.6.1-rc1, acpi_bus_add() calls acpi_bus_get_status() to evaluate
_STA, but botches checking the return value.  The result is that _STA
is ignored (if it was evaluated correctly), or we check garbage (if
the evaluation failed).  Here's a patch to fix it:

===== drivers/acpi/scan.c 1.19 vs edited =====
--- 1.19/drivers/acpi/scan.c	Sun May 25 18:00:00 2003
+++ edited/drivers/acpi/scan.c	Fri Jan  2 16:14:25 2004
@@ -703,11 +703,11 @@
 	switch (type) {
 	case ACPI_BUS_TYPE_DEVICE:
 		result = acpi_bus_get_status(device);
-		if (!result)
-			break;
-		if (!device->status.present) 
+		if (ACPI_FAILURE(result) || !device->status.present) {
 			result = -ENOENT;
-		goto end;
+			goto end;
+		}
+		break;
 	default:
 		STRUCT_TO_INT(device->status) = 0x0F;
 		break;



-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills.  Sign up for IBM's
Free Linux Tutorials.  Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click

             reply	other threads:[~2004-01-02 23:35 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-01-02 23:35 Bjorn Helgaas [this message]
     [not found] ` <200401021635.25419.bjorn.helgaas-VXdhtT5mjnY@public.gmane.org>
2004-01-12 19:47   ` [PATCH] Fix _STA checking in acpi_bus_add Bjorn Helgaas
2004-01-24  4:43   ` Len Brown
     [not found]     ` <1074919407.14755.6.camel-D2Zvc0uNKG8@public.gmane.org>
2004-01-26 16:15       ` Bjorn Helgaas
  -- strict thread matches above, loose matches on Subject: below --
2004-01-26 17:20 Brown, Len

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=200401021635.25419.bjorn.helgaas@hp.com \
    --to=bjorn.helgaas-vxdhtt5mjny@public.gmane.org \
    --cc=acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
    --cc=len.brown-ral2JQCrhuEAvxtiuMwx3w@public.gmane.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