{
int rc;
snd_seq_client_callback_t callback;
- snd_seq_client_info_t info;
- snd_seq_port_info_t port;
+ snd_seq_client_info_t *info;
+ snd_seq_port_info_t *port;
snd_seq_port_callback_t port_callback;
+ info = kmalloc(sizeof(*info), GFP_KERNEL);
+ port = kmalloc(sizeof(*port), GFP_KERNEL);
+ if (!info || !port) {
+ rc = -ENOMEM;
+ goto __error;
+ }
+
/* create ALSA client */
memset(&callback, 0, sizeof(callback));
rc = snd_seq_create_kernel_client(NULL, SNDRV_SEQ_CLIENT_OSS, &callback);
if (rc < 0)
- return rc;
+ goto __error;
system_client = rc;
debug_printk(("new client = %d\n", rc));
/* set client information */
- memset(&info, 0, sizeof(info));
- info.client = system_client;
- info.type = KERNEL_CLIENT;
- strcpy(info.name, "OSS sequencer");
+ memset(info, 0, sizeof(*info));
+ info->client = system_client;
+ info->type = KERNEL_CLIENT;
+ strcpy(info->name, "OSS sequencer");
- rc = call_ctl(SNDRV_SEQ_IOCTL_SET_CLIENT_INFO, &info);
+ rc = call_ctl(SNDRV_SEQ_IOCTL_SET_CLIENT_INFO, info);
/* look up midi devices */
snd_seq_oss_midi_lookup_ports(system_client);
/* create annoucement receiver port */
- memset(&port, 0, sizeof(port));
- strcpy(port.name, "Receiver");
- port.addr.client = system_client;
- port.capability = SNDRV_SEQ_PORT_CAP_WRITE; /* receive only */
- port.type = 0;
+ memset(port, 0, sizeof(*port));
+ strcpy(port->name, "Receiver");
+ port->addr.client = system_client;
+ port->capability = SNDRV_SEQ_PORT_CAP_WRITE; /* receive only */
+ port->type = 0;
memset(&port_callback, 0, sizeof(port_callback));
/* don't set port_callback.owner here. otherwise the module counter
* is incremented and we can no longer release the module..
*/
port_callback.event_input = receive_announce;
- port.kernel = &port_callback;
+ port->kernel = &port_callback;
- call_ctl(SNDRV_SEQ_IOCTL_CREATE_PORT, &port);
- if ((system_port = port.addr.port) >= 0) {
+ call_ctl(SNDRV_SEQ_IOCTL_CREATE_PORT, port);
+ if ((system_port = port->addr.port) >= 0) {
snd_seq_port_subscribe_t subs;
memset(&subs, 0, sizeof(subs));
subs.dest.port = system_port;
call_ctl(SNDRV_SEQ_IOCTL_SUBSCRIBE_PORT, &subs);
}
+ rc = 0;
-
- return 0;
+ __error:
+ kfree(port);
+ kfree(info);
+ return rc;
}
snd_seq_oss_timer_stop(dp->timer);
}
+
+/*
+ * misc. functions for proc interface
+ */
+char *
+enabled_str(int bool)
+{
+ return bool ? "enabled" : "disabled";
+}
+
+static char *
+filemode_str(int val)
+{
+ static char *str[] = {
+ "none", "read", "write", "read/write",
+ };
+ return str[val & SNDRV_SEQ_OSS_FILE_ACMODE];
+}
+
+
/*
* proc interface
*/
}
}
-/*
- * misc. functions for proc interface
- */
-char *
-enabled_str(int bool)
-{
- return bool ? "enabled" : "disabled";
-}
-
-char *
-filemode_str(int val)
-{
- static char *str[] = {
- "none", "read", "write", "read/write",
- };
- return str[val & SNDRV_SEQ_OSS_FILE_ACMODE];
-}
-
-