* [PATCH 1/1] ACPI: bus.c, fix error handling in acpi_bus_init
@ 2009-02-15 20:55 Jiri Slaby
2009-02-21 4:58 ` Len Brown
0 siblings, 1 reply; 3+ messages in thread
From: Jiri Slaby @ 2009-02-15 20:55 UTC (permalink / raw)
To: lenb; +Cc: linux-acpi, linux-kernel, Jiri Slaby
There was a misplaced status test. Move it to correct place and
rollback appropriately.
Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
---
drivers/acpi/bus.c | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c
index 765fd1c..79efef6 100644
--- a/drivers/acpi/bus.c
+++ b/drivers/acpi/bus.c
@@ -760,18 +760,17 @@ static int __init acpi_bus_init(void)
status = acpi_os_initialize1();
-
- status =
- acpi_enable_subsystem(ACPI_NO_HARDWARE_INIT | ACPI_NO_ACPI_ENABLE);
if (ACPI_FAILURE(status)) {
printk(KERN_ERR PREFIX
- "Unable to start the ACPI Interpreter\n");
- goto error1;
+ "Unable to initialize ACPI OS objects\n");
+ goto error0;
}
+ status =
+ acpi_enable_subsystem(ACPI_NO_HARDWARE_INIT | ACPI_NO_ACPI_ENABLE);
if (ACPI_FAILURE(status)) {
printk(KERN_ERR PREFIX
- "Unable to initialize ACPI OS objects\n");
+ "Unable to start the ACPI Interpreter\n");
goto error1;
}
@@ -832,6 +831,7 @@ static int __init acpi_bus_init(void)
/* Mimic structured exception handling */
error1:
acpi_terminate();
+error0:
return -ENODEV;
}
--
1.6.1.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 1/1] ACPI: bus.c, fix error handling in acpi_bus_init
2009-02-15 20:55 [PATCH 1/1] ACPI: bus.c, fix error handling in acpi_bus_init Jiri Slaby
@ 2009-02-21 4:58 ` Len Brown
2009-02-21 13:05 ` Jiri Slaby
0 siblings, 1 reply; 3+ messages in thread
From: Len Brown @ 2009-02-21 4:58 UTC (permalink / raw)
To: Jiri Slaby; +Cc: linux-acpi, linux-kernel
On Sun, 15 Feb 2009, Jiri Slaby wrote:
> There was a misplaced status test. Move it to correct place and
> rollback appropriately.
hmm, looks like this has been broken since the day
acpi_os_initialize1() was invented in 2004.
Turns out that the bug and its fix are moot, however,
as acpi_os_initialize1() is hard-coded to return success,
opting for BUG_ON() if it sees a failure...
So unless that changes, I'd prefer to keep the code
simple and just not check its status -- which is effectively
what we're doing right now.
thanks,
-Len
> Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
> ---
> drivers/acpi/bus.c | 12 ++++++------
> 1 files changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c
> index 765fd1c..79efef6 100644
> --- a/drivers/acpi/bus.c
> +++ b/drivers/acpi/bus.c
> @@ -760,18 +760,17 @@ static int __init acpi_bus_init(void)
>
>
> status = acpi_os_initialize1();
> -
> - status =
> - acpi_enable_subsystem(ACPI_NO_HARDWARE_INIT | ACPI_NO_ACPI_ENABLE);
> if (ACPI_FAILURE(status)) {
> printk(KERN_ERR PREFIX
> - "Unable to start the ACPI Interpreter\n");
> - goto error1;
> + "Unable to initialize ACPI OS objects\n");
> + goto error0;
> }
>
> + status =
> + acpi_enable_subsystem(ACPI_NO_HARDWARE_INIT | ACPI_NO_ACPI_ENABLE);
> if (ACPI_FAILURE(status)) {
> printk(KERN_ERR PREFIX
> - "Unable to initialize ACPI OS objects\n");
> + "Unable to start the ACPI Interpreter\n");
> goto error1;
> }
>
> @@ -832,6 +831,7 @@ static int __init acpi_bus_init(void)
> /* Mimic structured exception handling */
> error1:
> acpi_terminate();
> +error0:
> return -ENODEV;
> }
>
> --
> 1.6.1.3
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 1/1] ACPI: bus.c, fix error handling in acpi_bus_init
2009-02-21 4:58 ` Len Brown
@ 2009-02-21 13:05 ` Jiri Slaby
0 siblings, 0 replies; 3+ messages in thread
From: Jiri Slaby @ 2009-02-21 13:05 UTC (permalink / raw)
To: Len Brown; +Cc: linux-acpi, linux-kernel
On 21.2.2009 05:58, Len Brown wrote:
> On Sun, 15 Feb 2009, Jiri Slaby wrote:
>
>> There was a misplaced status test. Move it to correct place and
>> rollback appropriately.
>
> hmm, looks like this has been broken since the day
> acpi_os_initialize1() was invented in 2004.
It comes from bitkeeper times, I checked, it looked like a typo.
> Turns out that the bug and its fix are moot, however,
> as acpi_os_initialize1() is hard-coded to return success,
> opting for BUG_ON() if it sees a failure...
BUG_ON is not noreturn e.g. on embedded, anyway it would crash later in
this case. I was thinking about returning a failure when one of them is
NULL, but fell back to not do so and check only retval in the caller.
> So unless that changes, I'd prefer to keep the code
> simple and just not check its status -- which is effectively
> what we're doing right now.
Ok, no problem. Will repost.
Thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-02-21 13:06 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-15 20:55 [PATCH 1/1] ACPI: bus.c, fix error handling in acpi_bus_init Jiri Slaby
2009-02-21 4:58 ` Len Brown
2009-02-21 13:05 ` Jiri Slaby
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox