[PATCH alsa-lib 0/3] Trivial compile warning fixes
Hi,
here is a few patches to shut up trivial compile warnings that have been introduced recently.
Takashi
===
Takashi Iwai (3): pcm: rate: Fix compile warning wrt bit ops and comparison pcm: rate: Fix uninitialized variable warning topology: Add missing ATTRIBUTE_UNUSED
src/pcm/pcm_rate.c | 4 ++-- src/topology/pcm.c | 18 ++++++++++-------- 2 files changed, 12 insertions(+), 10 deletions(-)
We've got a gcc warning: pcm_rate.c: In function ‘snd_pcm_rate_drain’: pcm_rate.c:1090:19: warning: suggest parentheses around comparison in operand of ‘&’ [-Wparentheses] if (pcm->mode & SND_PCM_NONBLOCK != 0) { ^
Drop the zero comparison for fixing the warning and for simplicity.
Fixes: 29041c522071 ("fix infinite draining of the rate plugin in SND_PCM_NONBLOCK mode") Signed-off-by: Takashi Iwai tiwai@suse.de --- src/pcm/pcm_rate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/pcm/pcm_rate.c b/src/pcm/pcm_rate.c index 4f99a95b325f..980fa44e4023 100644 --- a/src/pcm/pcm_rate.c +++ b/src/pcm/pcm_rate.c @@ -1087,7 +1087,7 @@ static int snd_pcm_rate_drain(snd_pcm_t *pcm) if (rate->last_commit_ptr >= pcm->boundary) rate->last_commit_ptr = 0; } else if (commit_err == 0) { - if (pcm->mode & SND_PCM_NONBLOCK != 0) { + if (pcm->mode & SND_PCM_NONBLOCK) { commit_err = -EAGAIN; break; }
The recent gcc warning indicates the uninitialized variable commit_err: pcm_rate.c:1104:6: warning: ‘commit_err’ may be used uninitialized in this function [-Wmaybe-uninitialized] if (commit_err < 0) ^
Add a proper initialization to commit_err.
Fixes: 29041c522071 ("fix infinite draining of the rate plugin in SND_PCM_NONBLOCK mode") Signed-off-by: Takashi Iwai tiwai@suse.de --- src/pcm/pcm_rate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/pcm/pcm_rate.c b/src/pcm/pcm_rate.c index 980fa44e4023..9ec8c85ef13f 100644 --- a/src/pcm/pcm_rate.c +++ b/src/pcm/pcm_rate.c @@ -1051,7 +1051,7 @@ static int snd_pcm_rate_drain(snd_pcm_t *pcm) /* commit the remaining fraction (if any) */ snd_pcm_uframes_t size, ofs, saved_avail_min; snd_pcm_sw_params_t sw_params; - int commit_err; + int commit_err = 0;
__snd_pcm_lock(pcm); /* temporarily set avail_min to one */
... to shut up the compiler warnings.
Fixes: b6c9afb4f59b ("topology: implement snd_tplg_decode") Signed-off-by: Takashi Iwai tiwai@suse.de --- src/topology/pcm.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-)
diff --git a/src/topology/pcm.c b/src/topology/pcm.c index 61159d33357c..b15b95045ab5 100644 --- a/src/topology/pcm.c +++ b/src/topology/pcm.c @@ -2053,20 +2053,22 @@ next: }
/* decode dai from the binary input */ -int tplg_decode_dai(snd_tplg_t *tplg, - size_t pos, - struct snd_soc_tplg_hdr *hdr, - void *bin, size_t size) +int tplg_decode_dai(snd_tplg_t *tplg ATTRIBUTE_UNUSED, + size_t pos ATTRIBUTE_UNUSED, + struct snd_soc_tplg_hdr *hdr ATTRIBUTE_UNUSED, + void *bin ATTRIBUTE_UNUSED, + size_t size ATTRIBUTE_UNUSED) { SNDERR("not implemented"); return -ENXIO; }
/* decode cc from the binary input */ -int tplg_decode_cc(snd_tplg_t *tplg, - size_t pos, - struct snd_soc_tplg_hdr *hdr, - void *bin, size_t size) +int tplg_decode_cc(snd_tplg_t *tplg ATTRIBUTE_UNUSED, + size_t pos ATTRIBUTE_UNUSED, + struct snd_soc_tplg_hdr *hdr ATTRIBUTE_UNUSED, + void *bin ATTRIBUTE_UNUSED, + size_t size ATTRIBUTE_UNUSED) { SNDERR("not implemented"); return -ENXIO;
Dne 11. 05. 20 v 16:39 Takashi Iwai napsal(a):
Hi,
here is a few patches to shut up trivial compile warnings that have been introduced recently.
Reviewed-by: Jaroslav Kysela perex@perex.cz
Thank you, Jaroslav
Takashi
===
Takashi Iwai (3): pcm: rate: Fix compile warning wrt bit ops and comparison pcm: rate: Fix uninitialized variable warning topology: Add missing ATTRIBUTE_UNUSED
src/pcm/pcm_rate.c | 4 ++-- src/topology/pcm.c | 18 ++++++++++-------- 2 files changed, 12 insertions(+), 10 deletions(-)
participants (2)
-
Jaroslav Kysela
-
Takashi Iwai