ALSA: fix compiler warnings
cover ALSA: fix compiler warnings
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(-)
Signature · 6 lines
2.20.1 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
PATCH 1/2 ALSA: HDA: patch_realtek: fix empty macro usage in if block
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
--- sound/pci/hda/patch_realtek.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/pci/hda/patch_realtek.c +2 -2
@@ -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)
Signature · 6 lines
2.20.1 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Takashi Iwai
AppliedRe: [alsa-devel] [PATCH 1/2] ALSA: HDA: patch_realtek: fix empty macro usage in if block
Quoted 14 lines · 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);
| ^
Quoted 6 lines
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 <[email protected]>
Thanks, applied now.
Takashi
_______________________________________________
Alsa-devel mailing list
[email protected]
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
PATCH 2/2 ALSA: usb: update old-style static const declaration
In reply to Pierre-Louis BossartGCC 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
--- sound/usb/mixer_quirks.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/usb/mixer_quirks.c +1 -1
@@ -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
Signature · 6 lines
2.20.1 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Takashi Iwai
AppliedRe: [alsa-devel] [PATCH 2/2] ALSA: usb: update old-style static const declaration
Quoted 6 lines · 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]
Quoted 6 lines
1694 | const static usb_mixer_elem_resume_func_t resume_funcs[] = { | ^~~~~Move static to the beginning of declaration
Signed-off-by Pierre-Louis Bossart <[email protected]>
Thanks, applied now.
Takashi
_______________________________________________
Alsa-devel mailing list
[email protected]
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel