All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kirill Marinushkin <kmarinushkin@birdec.tech>
To: Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.de>
Cc: alsa-devel@alsa-project.org,
	Kirill Marinushkin <kmarinushkin@birdec.tech>
Subject: [PATCH alsa-lib 2/2] pcm_dmix: Fix compiler warnings -Wunused-result
Date: Thu, 15 Nov 2018 08:19:57 +0100	[thread overview]
Message-ID: <20181115071957.22753-2-kmarinushkin@birdec.tech> (raw)
In-Reply-To: <20181115071957.22753-1-kmarinushkin@birdec.tech>

Before this commit, compilation of `pcm_dmix` causes warnings "ignoring
return value" for `fgets` operations:

~~~~
pcm_dmix_i386.c:108:5: warning: ignoring return value of 'fgets', declared
with attribute warn_unused_result [-Wunused-result]
     fgets(line, sizeof(line), in);
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~

This commit fixes the warnings.

Signed-off-by: Kirill Marinushkin <kmarinushkin@birdec.tech>
---
 src/pcm/pcm_dmix_i386.c   | 3 ++-
 src/pcm/pcm_dmix_x86_64.c | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/pcm/pcm_dmix_i386.c b/src/pcm/pcm_dmix_i386.c
index 1ab983a8..81265517 100644
--- a/src/pcm/pcm_dmix_i386.c
+++ b/src/pcm/pcm_dmix_i386.c
@@ -105,7 +105,8 @@ static void mix_select_callbacks(snd_pcm_direct_t *dmix)
 		in = fopen("/proc/cpuinfo", "r");
 		if (in) {
 			while (!feof(in)) {
-				fgets(line, sizeof(line), in);
+				if (!fgets(line, sizeof(line), in))
+					continue;
 				if (!strncmp(line, "processor", 9))
 					smp++;
 				else if (!strncmp(line, "flags", 5)) {
diff --git a/src/pcm/pcm_dmix_x86_64.c b/src/pcm/pcm_dmix_x86_64.c
index 34c40d4e..c96af69b 100644
--- a/src/pcm/pcm_dmix_x86_64.c
+++ b/src/pcm/pcm_dmix_x86_64.c
@@ -88,7 +88,8 @@ static void mix_select_callbacks(snd_pcm_direct_t *dmix)
 		in = fopen("/proc/cpuinfo", "r");
 		if (in) {
 			while (!feof(in)) {
-				fgets(line, sizeof(line), in);
+				if (!fgets(line, sizeof(line), in))
+					continue;
 				if (!strncmp(line, "processor", 9))
 					smp++;
 			}
-- 
2.13.6

  reply	other threads:[~2018-11-15  7:18 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-15  7:19 [PATCH alsa-lib 1/2] pcm_share: Fix compiler warnings -Wunused-result Kirill Marinushkin
2018-11-15  7:19 ` Kirill Marinushkin [this message]
2018-11-15 11:08 ` Takashi Iwai
2018-11-15 17:30   ` Kirill Marinushkin
2018-11-15 18:50     ` Takashi Iwai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181115071957.22753-2-kmarinushkin@birdec.tech \
    --to=kmarinushkin@birdec.tech \
    --cc=alsa-devel@alsa-project.org \
    --cc=perex@perex.cz \
    --cc=tiwai@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.