acpi: remove unused LIST_HEAD(acpi_device_list) && more static analysis

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I just came across this file and found this LIST_HEAD(acpi_device_list)
was referred in early days before 2.6.11 but not in use nowadays,
^1da177e drivers/acpi/scan.c (Linus Torvalds          2005-04-16
15:20:36 -0700   31) static LIST_HEAD(acpi_device_list);

it is expanded to this line of referring itself form so gcc won't emit
a warning,
static struct list_head acpi_device_list = { &(acpi_device_list),
&(acpi_device_list) };

If change to this line of just declaration then it could really cause
a gcc warning:
+static struct list_head acpi_device_list;
drivers/acpi/scan.c:31:25: warning: ‘acpi_device_list’ defined but not
used [-Wunused-variable]

Now I'm guessing the kernel code may have more such dead variables,
at least we could do a globally search to see there are more LIST_HEAD
declaration without a 2nd reference; but does anyone have done this before
or know any existing tools / such static analysis approaches?

Thanks,


===

$ git diff HEAD -- drivers/acpi/scan.c
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index 85cbfdc..7d26ae0 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -28,7 +28,7 @@ extern struct acpi_device *acpi_root;

 static const char *dummy_hid = "device";

-static LIST_HEAD(acpi_device_list);
 static LIST_HEAD(acpi_bus_id_list);
 DEFINE_MUTEX(acpi_device_lock);
 LIST_HEAD(acpi_wakeup_device_list);


-- 
Cheng Renquan (程任全)
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux