Skip to contentSkip to conversation

ALSA: seq: oss: Fix error check at system port creation

PATCH New Takashi Iwai 1 participant 1 message Jun 17, 2021 Sound

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ALSA: seq: oss: Fix error check at system port creation

The system port creation in ALSA OSS sequencer was wrongly checked against to the port number that can be never negative. The error code should be checked rather against the ioctl call.

This patch corrects the error check.

---
 sound/core/seq/oss/seq_oss_init.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
sound/core/seq/oss/seq_oss_init.c +2 -3
index a53d81a86af2..0ee4a5081fd6 100644
@@ -94,11 +94,10 @@ snd_seq_oss_create_client(void)
 	port_callback.event_input = receive_announce;
 	port->kernel = &port_callback;
 	
-	call_ctl(SNDRV_SEQ_IOCTL_CREATE_PORT, port);
-	system_port = port->addr.port;
-	if (system_port >= 0) {
+	if (call_ctl(SNDRV_SEQ_IOCTL_CREATE_PORT, port) >= 0) {
 		struct snd_seq_port_subscribe subs;
 
+		system_port = port->addr.port;
 		memset(&subs, 0, sizeof(subs));
 		subs.sender.client = SNDRV_SEQ_CLIENT_SYSTEM;
 		subs.sender.port = SNDRV_SEQ_PORT_SYSTEM_ANNOUNCE;
Signature · 1 line
2.26.2