Trivial compile warning fixes
cover 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(-)
Signature · 1 line
2.16.4
PATCH 1/3 pcm: rate: Fix compile warning wrt bit ops and comparison
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.
--- src/pcm/pcm_rate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
src/pcm/pcm_rate.c +1 -1
@@ -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 ; }
Signature · 1 line
2.16.4
PATCH 2/3 pcm: rate: Fix uninitialized variable warning
In reply to Takashi IwaiThe 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.
--- src/pcm/pcm_rate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
src/pcm/pcm_rate.c +1 -1
@@ -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 */
Signature · 1 line
2.16.4
PATCH 3/3 topology: Add missing ATTRIBUTE_UNUSED
In reply to Takashi Iwai... to shut up the compiler warnings.
--- src/topology/pcm.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-)
src/topology/pcm.c +10 -8
@@ -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 ;
Signature · 1 line
2.16.4
Dne 11. 05. 20 v 16:39 Takashi Iwai napsal(a):
Quoted 4 lines
Hi,
here is a few patches to shut up trivial compile warnings that have been introduced recently.
Thank you,
Jaroslav
Quoted 15 lines
Takashi
===
Takashi Iwai (3):
pcm: rate: Fix compile warning wrt bit ops and comparison
pcm: rate: Fix uninitialized variable warning
topology: Add missingATTRIBUTE_UNUSEDsrc/pcm/pcm_rate.c | 4 ++-- src/topology/pcm.c | 18 ++++++++++-------- 2 files changed, 12 insertions(+), 10 deletions(-)
Signature · 2 lines
Jaroslav Kysela <[email protected]> Linux Sound Maintainer; ALSA Project; Red Hat, Inc.