alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
* [PATCH alsa-lib 0/3] Trivial compile warning fixes
@ 2020-05-11 14:39 Takashi Iwai
  2020-05-11 14:39 ` [PATCH alsa-lib 1/3] pcm: rate: Fix compile warning wrt bit ops and comparison Takashi Iwai
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Takashi Iwai @ 2020-05-11 14:39 UTC (permalink / raw)
  To: alsa-devel

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(-)

-- 
2.16.4


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

* [PATCH alsa-lib 1/3] pcm: rate: Fix compile warning wrt bit ops and comparison
  2020-05-11 14:39 [PATCH alsa-lib 0/3] Trivial compile warning fixes Takashi Iwai
@ 2020-05-11 14:39 ` Takashi Iwai
  2020-05-11 14:39 ` [PATCH alsa-lib 2/3] pcm: rate: Fix uninitialized variable warning Takashi Iwai
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Takashi Iwai @ 2020-05-11 14:39 UTC (permalink / raw)
  To: alsa-devel

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;
 				}
-- 
2.16.4


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

* [PATCH alsa-lib 2/3] pcm: rate: Fix uninitialized variable warning
  2020-05-11 14:39 [PATCH alsa-lib 0/3] Trivial compile warning fixes Takashi Iwai
  2020-05-11 14:39 ` [PATCH alsa-lib 1/3] pcm: rate: Fix compile warning wrt bit ops and comparison Takashi Iwai
@ 2020-05-11 14:39 ` Takashi Iwai
  2020-05-11 14:39 ` [PATCH alsa-lib 3/3] topology: Add missing ATTRIBUTE_UNUSED Takashi Iwai
  2020-05-11 15:14 ` [PATCH alsa-lib 0/3] Trivial compile warning fixes Jaroslav Kysela
  3 siblings, 0 replies; 5+ messages in thread
From: Takashi Iwai @ 2020-05-11 14:39 UTC (permalink / raw)
  To: alsa-devel

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 */
-- 
2.16.4


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

* [PATCH alsa-lib 3/3] topology: Add missing ATTRIBUTE_UNUSED
  2020-05-11 14:39 [PATCH alsa-lib 0/3] Trivial compile warning fixes Takashi Iwai
  2020-05-11 14:39 ` [PATCH alsa-lib 1/3] pcm: rate: Fix compile warning wrt bit ops and comparison Takashi Iwai
  2020-05-11 14:39 ` [PATCH alsa-lib 2/3] pcm: rate: Fix uninitialized variable warning Takashi Iwai
@ 2020-05-11 14:39 ` Takashi Iwai
  2020-05-11 15:14 ` [PATCH alsa-lib 0/3] Trivial compile warning fixes Jaroslav Kysela
  3 siblings, 0 replies; 5+ messages in thread
From: Takashi Iwai @ 2020-05-11 14:39 UTC (permalink / raw)
  To: alsa-devel

... 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;
-- 
2.16.4


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

* Re: [PATCH alsa-lib 0/3] Trivial compile warning fixes
  2020-05-11 14:39 [PATCH alsa-lib 0/3] Trivial compile warning fixes Takashi Iwai
                   ` (2 preceding siblings ...)
  2020-05-11 14:39 ` [PATCH alsa-lib 3/3] topology: Add missing ATTRIBUTE_UNUSED Takashi Iwai
@ 2020-05-11 15:14 ` Jaroslav Kysela
  3 siblings, 0 replies; 5+ messages in thread
From: Jaroslav Kysela @ 2020-05-11 15:14 UTC (permalink / raw)
  To: Takashi Iwai, alsa-devel

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(-)
> 


-- 
Jaroslav Kysela <perex@perex.cz>
Linux Sound Maintainer; ALSA Project; Red Hat, Inc.

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

end of thread, other threads:[~2020-05-11 15:15 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-11 14:39 [PATCH alsa-lib 0/3] Trivial compile warning fixes Takashi Iwai
2020-05-11 14:39 ` [PATCH alsa-lib 1/3] pcm: rate: Fix compile warning wrt bit ops and comparison Takashi Iwai
2020-05-11 14:39 ` [PATCH alsa-lib 2/3] pcm: rate: Fix uninitialized variable warning Takashi Iwai
2020-05-11 14:39 ` [PATCH alsa-lib 3/3] topology: Add missing ATTRIBUTE_UNUSED Takashi Iwai
2020-05-11 15:14 ` [PATCH alsa-lib 0/3] Trivial compile warning fixes Jaroslav Kysela

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).