Skip to content

Commit

Permalink
ALSA: core: avoid -Wempty-body warnings
Browse files Browse the repository at this point in the history
Building with 'make W=1' shows some warnings about empty function-style
macros:

sound/core/pcm_memory.c: In function 'preallocate_pages':
sound/core/pcm_memory.c:236:49: error: suggest braces around empty body in an 'if' statement [-Werror=empty-body]
  236 |                 preallocate_info_init(substream);

sound/core/seq_device.c: In function 'snd_seq_device_dev_register':
sound/core/seq_device.c:163:41: error: suggest braces around empty body in an 'if' statement [-Werror=empty-body]
  163 |                 queue_autoload_drivers();

Change them to empty inline functions, which are more robust here.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Link: https://lore.kernel.org/r/20210322103128.547199-1-arnd@kernel.org
Signed-off-by: Takashi Iwai <tiwai@suse.de>
  • Loading branch information
Arnd Bergmann authored and Takashi Iwai committed Mar 22, 2021
1 parent d2b6f15 commit 940ba1f
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 6 deletions.
8 changes: 6 additions & 2 deletions sound/core/oss/pcm_oss.c
Original file line number Diff line number Diff line change
Expand Up @@ -3069,8 +3069,12 @@ static void snd_pcm_oss_proc_done(struct snd_pcm *pcm)
}
}
#else /* !CONFIG_SND_VERBOSE_PROCFS */
#define snd_pcm_oss_proc_init(pcm)
#define snd_pcm_oss_proc_done(pcm)
static inline void snd_pcm_oss_proc_init(struct snd_pcm *pcm)
{
}
static inline void snd_pcm_oss_proc_done(struct snd_pcm *pcm)
{
}
#endif /* CONFIG_SND_VERBOSE_PROCFS */

/*
Expand Down
4 changes: 3 additions & 1 deletion sound/core/pcm_memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,9 @@ static inline void preallocate_info_init(struct snd_pcm_substream *substream)
}

#else /* !CONFIG_SND_VERBOSE_PROCFS */
#define preallocate_info_init(s)
static inline void preallocate_info_init(struct snd_pcm_substream *substream)
{
}
#endif /* CONFIG_SND_VERBOSE_PROCFS */

/*
Expand Down
15 changes: 12 additions & 3 deletions sound/core/seq_device.c
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,19 @@ void snd_seq_device_load_drivers(void)
flush_work(&autoload_work);
}
EXPORT_SYMBOL(snd_seq_device_load_drivers);
#define cancel_autoload_drivers() cancel_work_sync(&autoload_work)

static inline void cancel_autoload_drivers(void)
{
cancel_work_sync(&autoload_work);
}
#else
#define queue_autoload_drivers() /* NOP */
#define cancel_autoload_drivers() /* NOP */
static inline void queue_autoload_drivers(void)
{
}

static inline void cancel_autoload_drivers(void)
{
}
#endif

/*
Expand Down

0 comments on commit 940ba1f

Please sign in to comment.