[bug report] ALSA: seq: Fix assignment in if condition
Dan Carpenter
dan.carpenter at oracle.com
Thu Jun 17 15:18:03 CEST 2021
Hello Takashi Iwai,
The patch f9a6bb841f73: "ALSA: seq: Fix assignment in if condition"
from Jun 8, 2021, leads to the following static checker warning:
sound/core/seq/oss/seq_oss_init.c:99 snd_seq_oss_create_client()
warn: 'port->addr.port' is unsigned
sound/core/seq/oss/seq_oss_init.c
82
83 /* create annoucement receiver port */
84 memset(port, 0, sizeof(*port));
85 strcpy(port->name, "Receiver");
86 port->addr.client = system_client;
87 port->capability = SNDRV_SEQ_PORT_CAP_WRITE; /* receive only */
88 port->type = 0;
89
90 memset(&port_callback, 0, sizeof(port_callback));
91 /* don't set port_callback.owner here. otherwise the module counter
92 * is incremented and we can no longer release the module..
93 */
94 port_callback.event_input = receive_announce;
95 port->kernel = &port_callback;
96
97 call_ctl(SNDRV_SEQ_IOCTL_CREATE_PORT, port);
98 system_port = port->addr.port;
99 if (system_port >= 0) {
^^^^^^^^^^^^^^^^
This was from the old code. It's not clear what is going on. I think
the condition can be deleted.
100 struct snd_seq_port_subscribe subs;
101
102 memset(&subs, 0, sizeof(subs));
103 subs.sender.client = SNDRV_SEQ_CLIENT_SYSTEM;
104 subs.sender.port = SNDRV_SEQ_PORT_SYSTEM_ANNOUNCE;
105 subs.dest.client = system_client;
106 subs.dest.port = system_port;
107 call_ctl(SNDRV_SEQ_IOCTL_SUBSCRIBE_PORT, &subs);
108 }
109 rc = 0;
110
111 /* look up midi devices */
112 schedule_work(&async_lookup_work);
113
114 __error:
115 kfree(port);
116 return rc;
117 }
regards,
dan carpenter
More information about the Alsa-devel
mailing list