lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 24 Oct 2007 18:27:13 +0200
From:	Adrian Bunk <bunk@...nel.org>
To:	Jeff Garzik <jeff@...zik.org>, lenb@...nel.org, mingo@...hat.com,
	hpa@...or.com
Cc:	LKML <linux-kernel@...r.kernel.org>, akpm@...ux-foundation.org,
	tglx@...utronix.de, linux-acpi@...r.kernel.org
Subject: [2.6 patch] x86/kernel/acpi/processor.c: fix SMP=n warning

On Tue, Oct 23, 2007 at 06:36:33PM -0400, Jeff Garzik wrote:
> Fix !CONFIG_SMP warning:
> 
> arch/x86/kernel/acpi/processor.c: In function ‘arch_acpi_processor_init_pdc’:
> arch/x86/kernel/acpi/processor.c:65: warning: unused variable ‘cpu’
> 
> Signed-off-by: Jeff Garzik <jgarzik@...hat.com>
> ---
> Ideally this warning should be hidden inside a wrapper or somesuch, to
> camouflage the unneeded argument in !SMP case.
> 
> diff --git a/arch/x86/kernel/acpi/processor.c b/arch/x86/kernel/acpi/processor.c
> index 2ed0a4c..45e262a 100644
> --- a/arch/x86/kernel/acpi/processor.c
> +++ b/arch/x86/kernel/acpi/processor.c
> @@ -62,7 +62,9 @@ static void init_intel_pdc(struct acpi_processor *pr, struct cpuinfo_x86 *c)
>  /* Initialize _PDC data based on the CPU vendor */
>  void arch_acpi_processor_init_pdc(struct acpi_processor *pr)
>  {
> +#ifdef CONFIG_SMP
>  	unsigned int cpu = pr->id;
> +#endif
>...

The #ifdef is ugly.

What about the patch below instead?

cu
Adrian


<--  snip  -->



This patch fixes the following warning with CONFIG_SMP=n:

<--  snip  -->

...
arch/x86/kernel/acpi/processor.c: In function `arch_acpi_processor_init_pdc':
arch/x86/kernel/acpi/processor.c:65: warning: unused variable `cpu'
...

<--  snip  -->

Based on a patch by Jeff Garzik.

Signed-off-by: Adrian Bunk <bunk@...nel.org>

---
96d83d412fb6530173110c872f1125ae21938a99 
diff --git a/arch/x86/kernel/acpi/processor.c b/arch/x86/kernel/acpi/processor.c
index 2ed0a4c..f63e5ff 100644
--- a/arch/x86/kernel/acpi/processor.c
+++ b/arch/x86/kernel/acpi/processor.c
@@ -62,8 +62,7 @@ static void init_intel_pdc(struct acpi_processor *pr, struct cpuinfo_x86 *c)
 /* Initialize _PDC data based on the CPU vendor */
 void arch_acpi_processor_init_pdc(struct acpi_processor *pr)
 {
-	unsigned int cpu = pr->id;
-	struct cpuinfo_x86 *c = &cpu_data(cpu);
+	struct cpuinfo_x86 *c = &cpu_data(pr->id);
 
 	pr->pdc = NULL;
 	if (c->x86_vendor == X86_VENDOR_INTEL)

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ