mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andi Kleen <andi@firstfloor.org>
To: lenb@kernel.org, linux-acpi@vger.kernel.org,
	akpm@linux-foundation.org, linux-kernel@vger.kernel.org
Subject: [PATCH] [18/23] ACPI: Fix unused but set variables in ACPI
Date: Thu, 10 Jun 2010 13:10:54 +0200 (CEST)	[thread overview]
Message-ID: <20100610111054.49C89B1A2B@basil.firstfloor.org> (raw)
In-Reply-To: <20100610110.764742110@firstfloor.org>


Some minor improvements in error handling, but overall
it was mostly dead code.

cc: lenb@kernel.org
cc: linux-acpi@vger.kernel.org

Signed-off-by: Andi Kleen <ak@linux.intel.com>

---
 drivers/acpi/acpica/utmutex.c    |    5 +----
 drivers/acpi/numa.c              |    4 +---
 drivers/acpi/osl.c               |    7 +++----
 drivers/acpi/power.c             |    6 +-----
 drivers/acpi/processor_idle.c    |    3 +--
 drivers/acpi/processor_thermal.c |    2 ++
 drivers/acpi/video.c             |   10 +++++-----
 drivers/ata/libata-acpi.c        |    6 ------
 8 files changed, 14 insertions(+), 29 deletions(-)

Index: linux-2.6.35-rc2-gcc/drivers/acpi/processor_thermal.c
===================================================================
--- linux-2.6.35-rc2-gcc.orig/drivers/acpi/processor_thermal.c
+++ linux-2.6.35-rc2-gcc/drivers/acpi/processor_thermal.c
@@ -506,6 +506,8 @@ static ssize_t acpi_processor_write_limi
 	}
 
 	result = acpi_processor_apply_limit(pr);
+	if (result < 0)
+		return result;
 
 	return count;
 }
Index: linux-2.6.35-rc2-gcc/drivers/acpi/acpica/utmutex.c
===================================================================
--- linux-2.6.35-rc2-gcc.orig/drivers/acpi/acpica/utmutex.c
+++ linux-2.6.35-rc2-gcc/drivers/acpi/acpica/utmutex.c
@@ -279,13 +279,10 @@ acpi_status acpi_ut_acquire_mutex(acpi_m
 
 acpi_status acpi_ut_release_mutex(acpi_mutex_handle mutex_id)
 {
-	acpi_thread_id this_thread_id;
-
 	ACPI_FUNCTION_NAME(ut_release_mutex);
 
-	this_thread_id = acpi_os_get_thread_id();
 	ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Thread %p releasing Mutex [%s]\n",
-			  ACPI_CAST_PTR(void, this_thread_id),
+			  ACPI_CAST_PTR(void, acpi_os_get_thread_id()),
 			  acpi_ut_get_mutex_name(mutex_id)));
 
 	if (mutex_id > ACPI_MAX_MUTEX) {
Index: linux-2.6.35-rc2-gcc/drivers/acpi/numa.c
===================================================================
--- linux-2.6.35-rc2-gcc.orig/drivers/acpi/numa.c
+++ linux-2.6.35-rc2-gcc/drivers/acpi/numa.c
@@ -255,12 +255,10 @@ acpi_parse_memory_affinity(struct acpi_s
 
 static int __init acpi_parse_srat(struct acpi_table_header *table)
 {
-	struct acpi_table_srat *srat;
-
 	if (!table)
 		return -EINVAL;
 
-	srat = (struct acpi_table_srat *)table;
+	/* Real work done in acpi_table_parse_srat below. */
 
 	return 0;
 }
Index: linux-2.6.35-rc2-gcc/drivers/acpi/osl.c
===================================================================
--- linux-2.6.35-rc2-gcc.orig/drivers/acpi/osl.c
+++ linux-2.6.35-rc2-gcc/drivers/acpi/osl.c
@@ -141,15 +141,14 @@ static struct osi_linux {
 static void __init acpi_request_region (struct acpi_generic_address *addr,
 	unsigned int length, char *desc)
 {
-	struct resource *res;
-
 	if (!addr->address || !length)
 		return;
 
+	/* Resources are never freed */
 	if (addr->space_id == ACPI_ADR_SPACE_SYSTEM_IO)
-		res = request_region(addr->address, length, desc);
+		request_region(addr->address, length, desc);
 	else if (addr->space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY)
-		res = request_mem_region(addr->address, length, desc);
+		request_mem_region(addr->address, length, desc);
 }
 
 static int __init acpi_reserve_resources(void)
Index: linux-2.6.35-rc2-gcc/drivers/acpi/processor_idle.c
===================================================================
--- linux-2.6.35-rc2-gcc.orig/drivers/acpi/processor_idle.c
+++ linux-2.6.35-rc2-gcc/drivers/acpi/processor_idle.c
@@ -795,13 +795,12 @@ static inline void acpi_idle_do_entry(st
 	} else if (cx->entry_method == ACPI_CSTATE_HALT) {
 		acpi_safe_halt();
 	} else {
-		int unused;
 		/* IO port based C-state */
 		inb(cx->address);
 		/* Dummy wait op - must do something useless after P_LVL2 read
 		   because chipsets cannot guarantee that STPCLK# signal
 		   gets asserted in time to freeze execution properly. */
-		unused = inl(acpi_gbl_FADT.xpm_timer_block.address);
+		inl(acpi_gbl_FADT.xpm_timer_block.address);
 	}
 	start_critical_timings();
 }
Index: linux-2.6.35-rc2-gcc/drivers/acpi/video.c
===================================================================
--- linux-2.6.35-rc2-gcc.orig/drivers/acpi/video.c
+++ linux-2.6.35-rc2-gcc/drivers/acpi/video.c
@@ -2140,7 +2140,7 @@ acpi_video_bus_get_devices(struct acpi_v
 		status = acpi_video_bus_get_one_device(dev, video);
 		if (ACPI_FAILURE(status)) {
 			printk(KERN_WARNING PREFIX
-					"Cant attach device");
+					"Cant attach device\n");
 			continue;
 		}
 	}
@@ -2150,19 +2150,19 @@ acpi_video_bus_get_devices(struct acpi_v
 static int acpi_video_bus_put_one_device(struct acpi_video_device *device)
 {
 	acpi_status status;
-	struct acpi_video_bus *video;
-
 
 	if (!device || !device->video)
 		return -ENOENT;
 
-	video = device->video;
-
 	acpi_video_device_remove_fs(device->dev);
 
 	status = acpi_remove_notify_handler(device->dev->handle,
 					    ACPI_DEVICE_NOTIFY,
 					    acpi_video_device_notify);
+	if (ACPI_FAILURE(status)) {
+		printk(KERN_WARNING PREFIX
+		       "Cant remove video notify handler\n");
+	}
 	if (device->backlight) {
 		sysfs_remove_link(&device->backlight->dev.kobj, "device");
 		backlight_device_unregister(device->backlight);
Index: linux-2.6.35-rc2-gcc/drivers/ata/libata-acpi.c
===================================================================
--- linux-2.6.35-rc2-gcc.orig/drivers/ata/libata-acpi.c
+++ linux-2.6.35-rc2-gcc/drivers/ata/libata-acpi.c
@@ -145,12 +145,6 @@ static void ata_acpi_handle_hotplug(stru
 	struct ata_eh_info *ehi = &ap->link.eh_info;
 	int wait = 0;
 	unsigned long flags;
-	acpi_handle handle;
-
-	if (dev)
-		handle = dev->acpi_handle;
-	else
-		handle = ap->acpi_handle;
 
 	spin_lock_irqsave(ap->lock, flags);
 	/*
Index: linux-2.6.35-rc2-gcc/drivers/acpi/power.c
===================================================================
--- linux-2.6.35-rc2-gcc.orig/drivers/acpi/power.c
+++ linux-2.6.35-rc2-gcc/drivers/acpi/power.c
@@ -553,8 +553,6 @@ static int acpi_power_seq_show(struct se
 	int result = 0, state;
 	struct acpi_power_resource *resource = NULL;
 	struct list_head *node, *next;
-	struct acpi_power_reference *ref;
-
 
 	resource = seq->private;
 
@@ -579,10 +577,8 @@ static int acpi_power_seq_show(struct se
 	}
 
 	mutex_lock(&resource->resource_lock);
-	list_for_each_safe(node, next, &resource->reference) {
-		ref = container_of(node, struct acpi_power_reference, node);
+	list_for_each_safe(node, next, &resource->reference)
 		count++;
-	}
 	mutex_unlock(&resource->resource_lock);
 
 	seq_printf(seq, "system level:            S%d\n"

  parent reply	other threads:[~2010-06-10 11:11 UTC|newest]

Thread overview: 58+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-10 11:10 [PATCH] [0/23] Fix gcc 4.6 set but unused variable warnings Andi Kleen
2010-06-10 11:10 ` [PATCH] [1/23] x86: percpu: Avoid warnings of unused variables in per cpu Andi Kleen
2010-06-10 11:14   ` Tejun Heo
2010-06-10 12:09     ` Ingo Molnar
2010-06-10 17:43       ` Justin P. Mattock
2010-06-10 18:10         ` Andi Kleen
2010-06-10 18:26           ` Justin P. Mattock
2010-06-10 20:10           ` Justin P. Mattock
2010-06-10 12:24     ` [tip:x86/urgent] percpu, x86: " tip-bot for Andi Kleen
2010-06-10 11:10 ` [PATCH] [2/23] IRQ: Move alloc_desk_mask variables inside ifdef Andi Kleen
2010-06-10 11:10 ` [PATCH] [3/23] x86: Avoid unused by set variables in rdmsr Andi Kleen
2010-06-10 11:10 ` [PATCH] [4/23] pagemap: Avoid unused-but-set variable Andi Kleen
2010-06-18 23:28   ` Andrew Morton
2010-06-19  7:44     ` Andi Kleen
2010-06-10 11:10 ` [PATCH] [5/23] x86 boot: Set ax register in boot vga query Andi Kleen
2010-06-10 17:13   ` H. Peter Anvin
2010-06-10 23:42   ` [tip:x86/urgent] x86, setup: " tip-bot for Andi Kleen
2010-06-10 11:10 ` [PATCH] [6/23] perf: Fix set but unused variables in perf Andi Kleen
2010-06-10 11:10 ` [PATCH] [7/23] x86: fix set but not read variables Andi Kleen
2010-06-10 11:10 ` [PATCH] [8/23] KGDB: Remove set but unused newPC Andi Kleen
2010-07-30 11:59   ` Jason Wessel
2010-06-10 11:10 ` [PATCH] [9/23] PRINTK: Use stable variable to dump kmsg buffer Andi Kleen
2010-06-10 11:10 ` [PATCH] [10/23] SCHED: Only allocate per cpu cpu mask buffer with offstack cpumasks Andi Kleen
2010-06-10 14:43   ` Peter Zijlstra
2010-06-10 14:52     ` Andi Kleen
2010-06-10 14:55       ` Peter Zijlstra
2010-06-10 15:06         ` Andi Kleen
2010-06-10 15:19           ` Peter Zijlstra
2010-06-10 15:34             ` Andi Kleen
2010-06-10 11:10 ` [PATCH] [11/23] KVM: Fix KVM_SET_SIGNAL_MASK Andi Kleen
2010-06-10 14:16   ` Avi Kivity
2010-06-10 11:10 ` [PATCH] [12/23] BTRFS: Clean up unused variables -- bugs Andi Kleen
2010-06-10 11:10 ` [PATCH] [13/23] BTRFS: Clean up unused variables -- nonbugs Andi Kleen
2010-06-10 11:10 ` [PATCH] [14/23] NFSD: Fix initialized but not read warnings Andi Kleen
2010-06-10 11:10 ` [PATCH] [15/23] EXT4: Fix initialized but not read variables Andi Kleen
2010-06-14 17:20   ` tytso
2010-06-10 11:10 ` [PATCH] [16/23] XFS: Fix gcc 4.6 set but not read and unused statement warnings Andi Kleen
2010-06-11 16:20   ` Christoph Hellwig
2010-06-11 16:36     ` Andi Kleen
2010-06-14  4:27   ` Dave Chinner
2010-06-14  7:43     ` Andi Kleen
2010-06-14 13:37       ` Dave Chinner
2010-06-14 14:37         ` Andi Kleen
2010-06-14 22:24           ` Dave Chinner
2010-06-15  7:02             ` Andi Kleen
2010-06-15  7:40               ` Christoph Hellwig
2010-06-15  7:46                 ` Andi Kleen
2010-06-10 11:10 ` [PATCH] [17/23] EXT3: Fix set but unused variables Andi Kleen
2010-06-14 17:21   ` tytso
2010-06-14 17:27   ` tytso
2010-06-15 14:01     ` Jan Kara
2010-06-10 11:10 ` Andi Kleen [this message]
2010-06-10 11:10 ` [PATCH] [19/23] KVM: Fix unused but set warnings Andi Kleen
2010-06-10 14:19   ` Avi Kivity
2010-06-10 11:10 ` [PATCH] [20/23] MM: " Andi Kleen
2010-06-10 11:10 ` [PATCH] [21/23] kernel/*: " Andi Kleen
2010-06-10 11:10 ` [PATCH] [22/23] BLOCK: Fix unused but set variables in blk-merge Andi Kleen
2010-06-10 11:10 ` [PATCH] [23/23] FS: Fix unused but set warnings Andi Kleen

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=20100610111054.49C89B1A2B@basil.firstfloor.org \
    --to=andi@firstfloor.org \
    --cc=akpm@linux-foundation.org \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@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

Powered by JetHome