All of lore.kernel.org
 help / color / mirror / Atom feed
* [alsa-devel] [PATCH 0/2] ALSA: fix compiler warnings
@ 2020-01-11 21:47 Pierre-Louis Bossart
  2020-01-11 21:47 ` [alsa-devel] [PATCH 1/2] ALSA: HDA: patch_realtek: fix empty macro usage in if block Pierre-Louis Bossart
  2020-01-11 21:47 ` [alsa-devel] [PATCH 2/2] ALSA: usb: update old-style static const declaration Pierre-Louis Bossart
  0 siblings, 2 replies; 5+ messages in thread
From: Pierre-Louis Bossart @ 2020-01-11 21:47 UTC (permalink / raw)
  To: alsa-devel; +Cc: tiwai, broonie, Pierre-Louis Bossart

2 additional issues reported by GCC W=1. the first one looks like a
bug, the second one more of a style issue.

Fixes for ASoC will be provided separately after review/test.

Pierre-Louis Bossart (2):
  ALSA: HDA: patch_realtek: fix empty macro usage in if block
  ALSA: usb: update old-style static const declaration

 sound/pci/hda/patch_realtek.c | 4 ++--
 sound/usb/mixer_quirks.c      | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

-- 
2.20.1

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [alsa-devel] [PATCH 1/2] ALSA: HDA: patch_realtek: fix empty macro usage in if block
  2020-01-11 21:47 [alsa-devel] [PATCH 0/2] ALSA: fix compiler warnings Pierre-Louis Bossart
@ 2020-01-11 21:47 ` Pierre-Louis Bossart
  2020-01-12  8:43   ` Takashi Iwai
  2020-01-11 21:47 ` [alsa-devel] [PATCH 2/2] ALSA: usb: update old-style static const declaration Pierre-Louis Bossart
  1 sibling, 1 reply; 5+ messages in thread
From: Pierre-Louis Bossart @ 2020-01-11 21:47 UTC (permalink / raw)
  To: alsa-devel; +Cc: tiwai, broonie, Pierre-Louis Bossart

GCC reports the following warning with W=1

sound/pci/hda/patch_realtek.c: In function ‘alc269_suspend’:
sound/pci/hda/patch_realtek.c:3616:29: warning: suggest braces around
empty body in an ‘if’ statement [-Wempty-body]
 3616 |   alc5505_dsp_suspend(codec);
      |                             ^

sound/pci/hda/patch_realtek.c: In function ‘alc269_resume’:
sound/pci/hda/patch_realtek.c:3651:28: warning: suggest braces around empty body in an ‘if’ statement [-Wempty-body]
 3651 |   alc5505_dsp_resume(codec);
      |                            ^

This is a classic macro problem and can indeed lead to bad program
flows.

Fix by using the usual "do { } while (0)" pattern

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
---
 sound/pci/hda/patch_realtek.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 73407b25a777..d7b9bedff33c 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -3600,8 +3600,8 @@ static void alc5505_dsp_init(struct hda_codec *codec)
 }
 
 #ifdef HALT_REALTEK_ALC5505
-#define alc5505_dsp_suspend(codec)	/* NOP */
-#define alc5505_dsp_resume(codec)	/* NOP */
+#define alc5505_dsp_suspend(codec)	do { } while (0) /* NOP */
+#define alc5505_dsp_resume(codec)	do { } while (0) /* NOP */
 #else
 #define alc5505_dsp_suspend(codec)	alc5505_dsp_halt(codec)
 #define alc5505_dsp_resume(codec)	alc5505_dsp_back_from_halt(codec)
-- 
2.20.1

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [alsa-devel] [PATCH 2/2] ALSA: usb: update old-style static const declaration
  2020-01-11 21:47 [alsa-devel] [PATCH 0/2] ALSA: fix compiler warnings Pierre-Louis Bossart
  2020-01-11 21:47 ` [alsa-devel] [PATCH 1/2] ALSA: HDA: patch_realtek: fix empty macro usage in if block Pierre-Louis Bossart
@ 2020-01-11 21:47 ` Pierre-Louis Bossart
  2020-01-12  8:44   ` Takashi Iwai
  1 sibling, 1 reply; 5+ messages in thread
From: Pierre-Louis Bossart @ 2020-01-11 21:47 UTC (permalink / raw)
  To: alsa-devel; +Cc: tiwai, broonie, Pierre-Louis Bossart

GCC reports the following warning with W=1

sound/usb/mixer_quirks.c: In function ‘snd_microii_controls_create’:
sound/usb/mixer_quirks.c:1694:2: warning: ‘static’ is not at beginning
of declaration [-Wold-style-declaration]
 1694 |  const static usb_mixer_elem_resume_func_t resume_funcs[] = {
      |  ^~~~~

Move static to the beginning of declaration

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
---
 sound/usb/mixer_quirks.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/usb/mixer_quirks.c b/sound/usb/mixer_quirks.c
index b9f5a9c18040..c237e24f08d9 100644
--- a/sound/usb/mixer_quirks.c
+++ b/sound/usb/mixer_quirks.c
@@ -1691,7 +1691,7 @@ static const struct snd_kcontrol_new snd_microii_mixer_spdif[] = {
 static int snd_microii_controls_create(struct usb_mixer_interface *mixer)
 {
 	int err, i;
-	const static usb_mixer_elem_resume_func_t resume_funcs[] = {
+	static const usb_mixer_elem_resume_func_t resume_funcs[] = {
 		snd_microii_spdif_default_update,
 		NULL,
 		snd_microii_spdif_switch_update
-- 
2.20.1

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [alsa-devel] [PATCH 1/2] ALSA: HDA: patch_realtek: fix empty macro usage in if block
  2020-01-11 21:47 ` [alsa-devel] [PATCH 1/2] ALSA: HDA: patch_realtek: fix empty macro usage in if block Pierre-Louis Bossart
@ 2020-01-12  8:43   ` Takashi Iwai
  0 siblings, 0 replies; 5+ messages in thread
From: Takashi Iwai @ 2020-01-12  8:43 UTC (permalink / raw)
  To: Pierre-Louis Bossart; +Cc: alsa-devel, broonie

On Sat, 11 Jan 2020 22:47:35 +0100,
Pierre-Louis Bossart wrote:
> 
> GCC reports the following warning with W=1
> 
> sound/pci/hda/patch_realtek.c: In function ‘alc269_suspend’:
> sound/pci/hda/patch_realtek.c:3616:29: warning: suggest braces around
> empty body in an ‘if’ statement [-Wempty-body]
>  3616 |   alc5505_dsp_suspend(codec);
>       |                             ^
> 
> sound/pci/hda/patch_realtek.c: In function ‘alc269_resume’:
> sound/pci/hda/patch_realtek.c:3651:28: warning: suggest braces around empty body in an ‘if’ statement [-Wempty-body]
>  3651 |   alc5505_dsp_resume(codec);
>       |                            ^
> 
> This is a classic macro problem and can indeed lead to bad program
> flows.
> 
> Fix by using the usual "do { } while (0)" pattern
> 
> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

Thanks, applied now.


Takashi
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [alsa-devel] [PATCH 2/2] ALSA: usb: update old-style static const declaration
  2020-01-11 21:47 ` [alsa-devel] [PATCH 2/2] ALSA: usb: update old-style static const declaration Pierre-Louis Bossart
@ 2020-01-12  8:44   ` Takashi Iwai
  0 siblings, 0 replies; 5+ messages in thread
From: Takashi Iwai @ 2020-01-12  8:44 UTC (permalink / raw)
  To: Pierre-Louis Bossart; +Cc: alsa-devel, broonie

On Sat, 11 Jan 2020 22:47:36 +0100,
Pierre-Louis Bossart wrote:
> 
> GCC reports the following warning with W=1
> 
> sound/usb/mixer_quirks.c: In function ‘snd_microii_controls_create’:
> sound/usb/mixer_quirks.c:1694:2: warning: ‘static’ is not at beginning
> of declaration [-Wold-style-declaration]
>  1694 |  const static usb_mixer_elem_resume_func_t resume_funcs[] = {
>       |  ^~~~~
> 
> Move static to the beginning of declaration
> 
> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

Thanks, applied now.


Takashi
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-01-12  8:46 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-11 21:47 [alsa-devel] [PATCH 0/2] ALSA: fix compiler warnings Pierre-Louis Bossart
2020-01-11 21:47 ` [alsa-devel] [PATCH 1/2] ALSA: HDA: patch_realtek: fix empty macro usage in if block Pierre-Louis Bossart
2020-01-12  8:43   ` Takashi Iwai
2020-01-11 21:47 ` [alsa-devel] [PATCH 2/2] ALSA: usb: update old-style static const declaration Pierre-Louis Bossart
2020-01-12  8:44   ` Takashi Iwai

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.