Skip to contentSkip to conversation

/drivers/acpi/acpica/nsrepair.c (2.6.35.7) - Fixed useless compile warning

PATCH In review Poyo VL 3 participants 4 messages Sep 20, 2010 – Oct 5, 2010

Subsystems (2)
lore
Share & tools
lore

Poyo VL

author
#0 lore raw

PATCH 1/1 /drivers/acpi/acpica/nsrepair.c (2.6.35.7) - Fixed useless compile warning

This is not a problem, it is a simple fix for an ugly compiler warning. When I tried to cimpile, I got the following warning:
drivers/acpi/acpica/nsrepair.c: In function ‘acpi_ns_repair_object’:
drivers/acpi/acpica/nsrepair.c:125:29: warning: ‘new_object’ may be used uninitialized in this function
new_object is declared without being initialized. It is initialized in a conditional expression like if (expected_btypes & ACPI_RTYPE_INTEGER) so the compiler can't be sure that it will be used initialized, and it throws that warning.
Just have to initialize new_object which is a pointer with NULL. Patch:

---

drivers/acpi/acpica/nsrepair.c 2010-09-20 08:00:40.000000000 +0300 renamed from drivers/acpi/acpica/nsrepair.c 2010-09-20 08:35:56.568006487 +0300 +1 -1
@@ -122,7 +122,7 @@ acpi_ns_repair_object(struct acpi_predef
               union acpi_operand_object **return_object_ptr)
 {
     union acpi_operand_object *return_object = *return_object_ptr;
-    union acpi_operand_object *new_object;
+    union acpi_operand_object *new_object = NULL;
     acpi_status status;
 
     ACPI_FUNCTION_NAME(ns_repair_object);

--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

reviewer
#1 lore raw

thanks,
Len Brown, Intel Open Source Technology Center

Quoted 10 lines · Poyo VL

This is not a problem, it is a simple fix for an ugly compiler warning. When I tried to cimpile, I got the following warning:
drivers/acpi/acpica/nsrepair.c: In function ‘acpi_ns_repair_object’:
drivers/acpi/acpica/nsrepair.c:125:29: warning: ‘new_object’ may be used uninitialized in this function
new_object is declared without being initialized. It is initialized in a conditional expression like if (expected_btypes & ACPI_RTYPE_INTEGER) so the compiler can't be sure that it will be used initialized, and it throws that warning.
Just have to initialize new_object which is a pointer with NULL.

I don't see this warning.
What version of the compiler are you using?

thanks,
-Len

Quoted 17 lines

Patch:

---

drivers/acpi/acpica/nsrepair.c 2010-09-20 08:00:40.000000000 +0300 renamed from drivers/acpi/acpica/nsrepair.c 2010-09-20 08:35:56.568006487 +0300 +1 -1
@@ -122,7 +122,7 @@ acpi_ns_repair_object(struct acpi_predef
               union acpi_operand_object **return_object_ptr)
 {
     union acpi_operand_object *return_object = *return_object_ptr;
-    union acpi_operand_object *new_object;
+    union acpi_operand_object *new_object = NULL;
     acpi_status status;
 
     ACPI_FUNCTION_NAME(ns_repair_object);
#2 lore raw

Yes, do tell. Compiler and options used.

We don't see a warning on any of the compilers we test with, nor lint.

Thanks,
Bob

Quoted 54 lines

-----Original Message-----
From: Len Brown [mailto:[email protected]]
Sent: Thursday, September 30, 2010 11:14 PM
To: Poyo VL
Cc: [email protected]; Moore, Robert
Subject: Re: [PATCH] /drivers/acpi/acpica/nsrepair.c (2.6.35.7) - Fixed useless compile warning

thanks,
Len Brown, Intel Open Source Technology Center

Quoted 1 line · Poyo VL

This is not a problem, it is a simple fix for an ugly compiler warning.

When I

Quoted 6 lines

tried to cimpile, I got the following warning:
drivers/acpi/acpica/nsrepair.c: In function 'acpi_ns_repair_object':
drivers/acpi/acpica/nsrepair.c:125:29: warning: 'new_object' may be used uninitialized in this function
new_object is declared without being initialized. It is initialized in a conditional expression like if (expected_btypes & ACPI_RTYPE_INTEGER) so

the

Quoted 1 line

compiler can't be sure that it will be used initialized, and it throws

that

Quoted 2 lines

warning.
Just have to initialize new_object which is a pointer with NULL.

I don't see this warning.
What version of the compiler are you using?

thanks,
-Len

Quoted 6 lines

Patch:

---

--- a/drivers/acpi/acpica/nsrepair.c 2010-09-20 08:35:56.568006487

+0300

Quoted 1 line

+++ b/drivers/acpi/acpica/nsrepair.c 2010-09-20 08:00:40.000000000

+0300

Quoted 10 lines
drivers/acpi/acpica/nsrepair.c 2010-09-20 08:00:40.000000000 +0300 renamed from drivers/acpi/acpica/nsrepair.c 2010-09-20 08:35:56.568006487 +0300 +1 -1
@@ -122,7 +122,7 @@ acpi_ns_repair_object(struct acpi_predef
               union acpi_operand_object **return_object_ptr)
 {
     union acpi_operand_object *return_object = *return_object_ptr;
-    union acpi_operand_object *new_object;
+    union acpi_operand_object *new_object = NULL;
     acpi_status status;
 
     ACPI_FUNCTION_NAME(ns_repair_object);
#3 lore raw
In reply to Len Brown

Is there any other information on this?

Quoted 54 lines

-----Original Message-----
From: Len Brown [mailto:[email protected]]
Sent: Thursday, September 30, 2010 11:14 PM
To: Poyo VL
Cc: [email protected]; Moore, Robert
Subject: Re: [PATCH] /drivers/acpi/acpica/nsrepair.c (2.6.35.7) - Fixed useless compile warning

thanks,
Len Brown, Intel Open Source Technology Center

Quoted 1 line · Poyo VL

This is not a problem, it is a simple fix for an ugly compiler warning.

When I

Quoted 6 lines

tried to cimpile, I got the following warning:
drivers/acpi/acpica/nsrepair.c: In function 'acpi_ns_repair_object':
drivers/acpi/acpica/nsrepair.c:125:29: warning: 'new_object' may be used uninitialized in this function
new_object is declared without being initialized. It is initialized in a conditional expression like if (expected_btypes & ACPI_RTYPE_INTEGER) so

the

Quoted 1 line

compiler can't be sure that it will be used initialized, and it throws

that

Quoted 2 lines

warning.
Just have to initialize new_object which is a pointer with NULL.

I don't see this warning.
What version of the compiler are you using?

thanks,
-Len

Quoted 6 lines

Patch:

---

--- a/drivers/acpi/acpica/nsrepair.c 2010-09-20 08:35:56.568006487

+0300

Quoted 1 line

+++ b/drivers/acpi/acpica/nsrepair.c 2010-09-20 08:00:40.000000000

+0300

Quoted 10 lines
drivers/acpi/acpica/nsrepair.c 2010-09-20 08:00:40.000000000 +0300 renamed from drivers/acpi/acpica/nsrepair.c 2010-09-20 08:35:56.568006487 +0300 +1 -1
@@ -122,7 +122,7 @@ acpi_ns_repair_object(struct acpi_predef
               union acpi_operand_object **return_object_ptr)
 {
     union acpi_operand_object *return_object = *return_object_ptr;
-    union acpi_operand_object *new_object;
+    union acpi_operand_object *new_object = NULL;
     acpi_status status;
 
     ACPI_FUNCTION_NAME(ns_repair_object);