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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 25 Jan 2013 02:03:16 -0800
From:	Joe Perches <joe@...ches.com>
To:	Takashi Iwai <tiwai@...e.de>
Cc:	Stratos Karafotis <stratosk@...aphore.gr>,
	Jaroslav Kysela <perex@...ex.cz>,
	David Henningsson <david.henningsson@...onical.com>,
	alsa-devel@...a-project.org, linux-kernel@...r.kernel.org,
	linux-next@...r.kernel.org
Subject: Re: [PATCH next-20130124] Sound: pci: Fix unused variable warning
 in patch_sigmatel.c

On Fri, 2013-01-25 at 10:09 +0100, Takashi Iwai wrote:
> At Fri, 25 Jan 2013 00:38:06 +0200,
> Stratos Karafotis wrote:
> > Fix the following build warnings
> > sound/pci/hda/patch_sigmatel.c: In function ‘stac92hd71bxx_fixup_hp’:
> > sound/pci/hda/patch_sigmatel.c:2434:24: warning: unused variable ‘spec’ [-Wunused-variable]
[]
> I'm going to fix the definition of snd_printd() itself for fixing this
> kind of warnings.  We can use inline functions instead of empty macros
> to achieve the same but without triggering compiler warnings.

It's probably better to use a macro like:

do {						\
	if (0)					\
		printk(fmt, ##__VA_ARGS__);	\
} while (0)

to allow the compiler to avoid any argument evaluation
while still doing fmt/arg matching.

Something like:

 include/sound/core.h | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/include/sound/core.h b/include/sound/core.h
index 93896ad..ce5d224 100644
--- a/include/sound/core.h
+++ b/include/sound/core.h
@@ -394,8 +394,17 @@ void __snd_printk(unsigned int level, const char *file, int line,
 
 #else /* !CONFIG_SND_DEBUG */
 
-#define snd_printd(fmt, args...)	do { } while (0)
-#define _snd_printd(level, fmt, args...) do { } while (0)
+#define snd_printd(fmt, ...)						\
+do {									\
+	if (0)								\
+		__snd_printk(1, __FILE__, __LINE__, fmt, ##__VA_ARGS__); \
+} while (0)
+#define _snd_printd(level, fmt, ...)					\
+do {									\
+	if (0)								\
+		__snd_printk(level, __FILE__, __LINE__, fmt, ##__VA_ARGS__); \
+} while (0)
+
 #define snd_BUG()			do { } while (0)
 static inline int __snd_bug_on(int cond)
 {


--
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