Skip to contentSkip to conversation

snd_mixer_poll_descriptors_revents: iterate over all descriptors

PATCH In review Olivier Trichet 2 participants 3 messages Aug 4, 2011 – Sep 5, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 snd_mixer_poll_descriptors_revents: iterate over all descriptors

Hello,

Reading the method snd_mixer_poll_descriptors_revents, it seems to me that the iteration over the array 'pfds' is wrong.
Shouldn't the attached patch be applied?

Regards,
Olivier

src/mixer/mixer.c +1 -1
index 85d843f..c3269ea 100644
@@ -744,7 +744,7 @@ int snd_mixer_poll_descriptors_revents(snd_mixer_t *mixer, struct pollfd *pfds,
 		return -EINVAL;
 	res = 0;
 	for (idx = 0; idx < nfds; idx++)
-		res |= pfds->revents & (POLLIN|POLLERR|POLLNVAL);
+		res |= pfds[i]->revents & (POLLIN|POLLERR|POLLNVAL);
 	*revents = res;
 	return 0;
 }
#1 lore raw

At Thu, 4 Aug 2011 12:06:19 +0200,

Quoted 16 lines · Olivier Trichet

[1 <text/plain; utf-8 (7bit)>]
Hello,

Reading the method snd_mixer_poll_descriptors_revents, it seems to me that the iteration over the array 'pfds' is wrong.
Shouldn't the attached patch be applied?

Regards,
Olivier
[2 0001-snd_mixer_poll_descriptors_revents-iterate-over-all-.patch <text/x-patch; utf-8 (quoted-printable)>]

src/mixer/mixer.c +0 -0
index 85d843f..c3269ea 100644

src/mixer/mixer.c int snd_mixer_poll_descriptors_revents(snd_mixer_t *mixer, struct pollfd *pfds, · line 747

Quoted 5 lines
src/mixer/mixer.c +1 -1
@@ -744,7 +744,7 @@ int snd_mixer_poll_descriptors_revents(snd_mixer_t *mixer, struct pollfd *pfds,
 		return -EINVAL;
 	res = 0;
 	for (idx = 0; idx < nfds; idx++)
-		res |= pfds->revents & (POLLIN|POLLERR|POLLNVAL);
+		res |= pfds[i]->revents & (POLLIN|POLLERR|POLLNVAL);

You mean idx instead of i, right?

thanks,

Takashi

#2 lore raw
Quoted 23 lines · Takashi Iwai

At Thu, 4 Aug 2011 12:06:19 +0200,

Quoted 20 lines · Olivier Trichet

[1 <text/plain; utf-8 (7bit)>]
Hello,

Reading the method snd_mixer_poll_descriptors_revents, it seems to me that the iteration over the array 'pfds' is wrong. Shouldn't the attached patch be applied?

Regards,
Olivier
[2 0001-snd_mixer_poll_descriptors_revents-iterate-over-all-.patch <text/x-patch; utf-8 (quoted-printable)>] diff --git a/src/mixer/mixer.c b/src/mixer/mixer.c
index 85d843f..c3269ea 100644

src/mixer/mixer.c +0 -0
@@ -744,7 +744,7 @@ int snd_mixer_poll_descriptors_revents(snd_mixer_t
 *mixer, struct pollfd *pfds,
 
 		return -EINVAL;
 
Quoted 8 lines

src/mixer/mixer.c int snd_mixer_poll_descriptors_revents(snd_mixer_t *mixer, struct pollfd *pfds, · line 747

Quoted 5 lines
src/mixer/mixer.c +1 -1
 	res = 0;
 	for (idx = 0; idx < nfds; idx++)
 
-		res |= pfds->revents & (POLLIN|POLLERR|POLLNVAL);
+		res |= pfds[i]->revents & (POLLIN|POLLERR|POLLNVAL);

You mean idx instead of i, right?

I even meant pdfs[idx].revents instead of pdfs[i]->revents. Sorry.

Thanks for having a look.
Olivier