*/
static struct snd_seq_client *get_event_dest_client(struct snd_seq_event *event)
{
- struct snd_seq_client *dest __free(snd_seq_client) = NULL;
+ struct snd_seq_client *dest __free(snd_seq_client) =
+ snd_seq_client_use_ptr(event->dest.client);
- dest = snd_seq_client_use_ptr(event->dest.client);
if (dest == NULL)
return NULL;
if (! dest->accept_input)
static int update_timestamp_of_queue(struct snd_seq_event *event,
int queue, int real_time)
{
- struct snd_seq_queue *q __free(snd_seq_queue) = NULL;
+ struct snd_seq_queue *q __free(snd_seq_queue) =
+ queueptr(queue);
- q = queueptr(queue);
if (! q)
return 0;
event->queue = queue;
struct snd_seq_event *event,
int atomic, int hop)
{
- struct snd_seq_client *dest __free(snd_seq_client) = NULL;
- struct snd_seq_client_port *dest_port __free(snd_seq_port) = NULL;
-
- dest = get_event_dest_client(event);
+ struct snd_seq_client *dest __free(snd_seq_client) =
+ get_event_dest_client(event);
if (dest == NULL)
return -ENOENT;
- dest_port = snd_seq_port_use_ptr(dest, event->dest.port);
+
+ struct snd_seq_client_port *dest_port __free(snd_seq_port) =
+ snd_seq_port_use_ptr(dest, event->dest.port);
if (dest_port == NULL)
return -ENOENT;
struct snd_seq_event *event,
int port, int atomic, int hop)
{
- struct snd_seq_client_port *src_port __free(snd_seq_port) = NULL;
struct snd_seq_subscribers *subs;
int err, result = 0, num_ev = 0;
union __snd_seq_event event_saved;
if (port < 0)
return 0;
- src_port = snd_seq_port_use_ptr(client, port);
+
+ struct snd_seq_client_port *src_port __free(snd_seq_port) =
+ snd_seq_port_use_ptr(client, port);
if (!src_port)
return 0;
*/
int snd_seq_dispatch_event(struct snd_seq_event_cell *cell, int atomic, int hop)
{
- struct snd_seq_client *client __free(snd_seq_client) = NULL;
int result;
if (snd_BUG_ON(!cell))
return -EINVAL;
- client = snd_seq_client_use_ptr(cell->event.source.client);
+ struct snd_seq_client *client __free(snd_seq_client) =
+ snd_seq_client_use_ptr(cell->event.source.client);
if (client == NULL) {
snd_seq_cell_free(cell); /* release this cell */
return -EINVAL;
static int snd_seq_ioctl_running_mode(struct snd_seq_client *client, void *arg)
{
struct snd_seq_running_info *info = arg;
- struct snd_seq_client *cptr __free(snd_seq_client) = NULL;
-
/* requested client number */
- cptr = client_load_and_use_ptr(info->client);
+ struct snd_seq_client *cptr __free(snd_seq_client) =
+ client_load_and_use_ptr(info->client);
+
if (cptr == NULL)
return -ENOENT; /* don't change !!! */
void *arg)
{
struct snd_seq_client_info *client_info = arg;
- struct snd_seq_client *cptr __free(snd_seq_client) = NULL;
-
/* requested client number */
- cptr = client_load_and_use_ptr(client_info->client);
+ struct snd_seq_client *cptr __free(snd_seq_client) =
+ client_load_and_use_ptr(client_info->client);
+
if (cptr == NULL)
return -ENOENT; /* don't change !!! */
static int snd_seq_ioctl_get_port_info(struct snd_seq_client *client, void *arg)
{
struct snd_seq_port_info *info = arg;
- struct snd_seq_client *cptr __free(snd_seq_client) = NULL;
- struct snd_seq_client_port *port __free(snd_seq_port) = NULL;
- cptr = client_load_and_use_ptr(info->addr.client);
+ struct snd_seq_client *cptr __free(snd_seq_client) =
+ client_load_and_use_ptr(info->addr.client);
if (cptr == NULL)
return -ENXIO;
- port = snd_seq_port_use_ptr(cptr, info->addr.port);
+ struct snd_seq_client_port *port __free(snd_seq_port) =
+ snd_seq_port_use_ptr(cptr, info->addr.port);
if (port == NULL)
return -ENOENT; /* don't change */
static int snd_seq_ioctl_set_port_info(struct snd_seq_client *client, void *arg)
{
struct snd_seq_port_info *info = arg;
- struct snd_seq_client_port *port __free(snd_seq_port) = NULL;
if (info->addr.client != client->number) /* only set our own ports ! */
return -EPERM;
- port = snd_seq_port_use_ptr(client, info->addr.port);
+
+ struct snd_seq_client_port *port __free(snd_seq_port) =
+ snd_seq_port_use_ptr(client, info->addr.port);
if (port) {
snd_seq_set_port_info(port, info);
/* notify the change */
void *arg)
{
struct snd_seq_port_subscribe *subs = arg;
- struct snd_seq_client *receiver __free(snd_seq_client) = NULL;
- struct snd_seq_client *sender __free(snd_seq_client) = NULL;
- struct snd_seq_client_port *sport __free(snd_seq_port) = NULL;
- struct snd_seq_client_port *dport __free(snd_seq_port) = NULL;
int result;
- receiver = client_load_and_use_ptr(subs->dest.client);
+ struct snd_seq_client *receiver __free(snd_seq_client) =
+ client_load_and_use_ptr(subs->dest.client);
if (!receiver)
return -EINVAL;
- sender = client_load_and_use_ptr(subs->sender.client);
+ struct snd_seq_client *sender __free(snd_seq_client) =
+ client_load_and_use_ptr(subs->sender.client);
if (!sender)
return -EINVAL;
- sport = snd_seq_port_use_ptr(sender, subs->sender.port);
+ struct snd_seq_client_port *sport __free(snd_seq_port) =
+ snd_seq_port_use_ptr(sender, subs->sender.port);
if (!sport)
return -EINVAL;
- dport = snd_seq_port_use_ptr(receiver, subs->dest.port);
+ struct snd_seq_client_port *dport __free(snd_seq_port) =
+ snd_seq_port_use_ptr(receiver, subs->dest.port);
if (!dport)
return -EINVAL;
void *arg)
{
struct snd_seq_port_subscribe *subs = arg;
- struct snd_seq_client *receiver __free(snd_seq_client) = NULL;
- struct snd_seq_client *sender __free(snd_seq_client) = NULL;
- struct snd_seq_client_port *sport __free(snd_seq_port) = NULL;
- struct snd_seq_client_port *dport __free(snd_seq_port) = NULL;
int result;
- receiver = snd_seq_client_use_ptr(subs->dest.client);
+ struct snd_seq_client *receiver __free(snd_seq_client) =
+ snd_seq_client_use_ptr(subs->dest.client);
if (!receiver)
return -ENXIO;
- sender = snd_seq_client_use_ptr(subs->sender.client);
+ struct snd_seq_client *sender __free(snd_seq_client) =
+ snd_seq_client_use_ptr(subs->sender.client);
if (!sender)
return -ENXIO;
- sport = snd_seq_port_use_ptr(sender, subs->sender.port);
+ struct snd_seq_client_port *sport __free(snd_seq_port) =
+ snd_seq_port_use_ptr(sender, subs->sender.port);
if (!sport)
return -ENXIO;
- dport = snd_seq_port_use_ptr(receiver, subs->dest.port);
+ struct snd_seq_client_port *dport __free(snd_seq_port) =
+ snd_seq_port_use_ptr(receiver, subs->dest.port);
if (!dport)
return -ENXIO;
static int snd_seq_ioctl_create_queue(struct snd_seq_client *client, void *arg)
{
struct snd_seq_queue_info *info = arg;
- struct snd_seq_queue *q __free(snd_seq_queue) = NULL;
+ struct snd_seq_queue *q __free(snd_seq_queue) =
+ snd_seq_queue_alloc(client->number, info->locked, info->flags);
- q = snd_seq_queue_alloc(client->number, info->locked, info->flags);
if (IS_ERR(q))
return PTR_ERR(q);
void *arg)
{
struct snd_seq_queue_info *info = arg;
- struct snd_seq_queue *q __free(snd_seq_queue) = NULL;
+ struct snd_seq_queue *q __free(snd_seq_queue) =
+ queueptr(info->queue);
- q = queueptr(info->queue);
if (q == NULL)
return -EINVAL;
void *arg)
{
struct snd_seq_queue_info *info = arg;
- struct snd_seq_queue *q __free(snd_seq_queue) = NULL;
if (info->owner != client->number)
return -EINVAL;
return -EPERM;
}
- q = queueptr(info->queue);
+ struct snd_seq_queue *q __free(snd_seq_queue) =
+ queueptr(info->queue);
if (! q)
return -EINVAL;
if (q->owner != client->number)
void *arg)
{
struct snd_seq_queue_info *info = arg;
- struct snd_seq_queue *q __free(snd_seq_queue) = NULL;
+ struct snd_seq_queue *q __free(snd_seq_queue) =
+ snd_seq_queue_find_name(info->name);
- q = snd_seq_queue_find_name(info->name);
if (q == NULL)
return -EINVAL;
info->queue = q->queue;
void *arg)
{
struct snd_seq_queue_status *status = arg;
- struct snd_seq_queue *queue __free(snd_seq_queue) = NULL;
struct snd_seq_timer *tmr;
+ struct snd_seq_queue *queue __free(snd_seq_queue) =
+ queueptr(status->queue);
- queue = queueptr(status->queue);
if (queue == NULL)
return -EINVAL;
memset(status, 0, sizeof(*status));
void *arg)
{
struct snd_seq_queue_tempo *tempo = arg;
- struct snd_seq_queue *queue __free(snd_seq_queue) = NULL;
struct snd_seq_timer *tmr;
+ struct snd_seq_queue *queue __free(snd_seq_queue) =
+ queueptr(tempo->queue);
- queue = queueptr(tempo->queue);
if (queue == NULL)
return -EINVAL;
memset(tempo, 0, sizeof(*tempo));
void *arg)
{
struct snd_seq_queue_timer *timer = arg;
- struct snd_seq_queue *queue __free(snd_seq_queue) = NULL;
struct snd_seq_timer *tmr;
+ struct snd_seq_queue *queue __free(snd_seq_queue) =
+ queueptr(timer->queue);
- queue = queueptr(timer->queue);
if (queue == NULL)
return -EINVAL;
return -EINVAL;
if (snd_seq_queue_check_access(timer->queue, client->number)) {
- struct snd_seq_queue *q __free(snd_seq_queue) = NULL;
struct snd_seq_timer *tmr;
+ struct snd_seq_queue *q __free(snd_seq_queue) =
+ queueptr(timer->queue);
- q = queueptr(timer->queue);
if (q == NULL)
return -ENXIO;
guard(mutex)(&q->timer_mutex);
void *arg)
{
struct snd_seq_client_pool *info = arg;
- struct snd_seq_client *cptr __free(snd_seq_client) = NULL;
+ struct snd_seq_client *cptr __free(snd_seq_client) =
+ client_load_and_use_ptr(info->client);
- cptr = client_load_and_use_ptr(info->client);
if (cptr == NULL)
return -ENOENT;
memset(info, 0, sizeof(*info));
void *arg)
{
struct snd_seq_port_subscribe *subs = arg;
- struct snd_seq_client *sender __free(snd_seq_client) = NULL;
- struct snd_seq_client_port *sport __free(snd_seq_port) = NULL;
- sender = client_load_and_use_ptr(subs->sender.client);
+ struct snd_seq_client *sender __free(snd_seq_client) =
+ client_load_and_use_ptr(subs->sender.client);
if (!sender)
return -EINVAL;
- sport = snd_seq_port_use_ptr(sender, subs->sender.port);
+ struct snd_seq_client_port *sport __free(snd_seq_port) =
+ snd_seq_port_use_ptr(sender, subs->sender.port);
if (!sport)
return -EINVAL;
return snd_seq_port_get_subscription(&sport->c_src, &subs->dest, subs);
static int snd_seq_ioctl_query_subs(struct snd_seq_client *client, void *arg)
{
struct snd_seq_query_subs *subs = arg;
- struct snd_seq_client *cptr __free(snd_seq_client) = NULL;
- struct snd_seq_client_port *port __free(snd_seq_port) = NULL;
struct snd_seq_port_subs_info *group;
struct list_head *p;
int i;
- cptr = client_load_and_use_ptr(subs->root.client);
+ struct snd_seq_client *cptr __free(snd_seq_client) =
+ client_load_and_use_ptr(subs->root.client);
if (!cptr)
return -ENXIO;
- port = snd_seq_port_use_ptr(cptr, subs->root.port);
+ struct snd_seq_client_port *port __free(snd_seq_port) =
+ snd_seq_port_use_ptr(cptr, subs->root.port);
if (!port)
return -ENXIO;
void *arg)
{
struct snd_seq_client_info *info = arg;
- struct snd_seq_client *cptr __free(snd_seq_client) = NULL;
/* search for next client */
if (info->client < INT_MAX)
if (info->client < 0)
info->client = 0;
for (; info->client < SNDRV_SEQ_MAX_CLIENTS; info->client++) {
- cptr = client_load_and_use_ptr(info->client);
+ struct snd_seq_client *cptr __free(snd_seq_client) =
+ client_load_and_use_ptr(info->client);
if (cptr) {
get_client_info(cptr, info);
return 0; /* found */
void *arg)
{
struct snd_seq_port_info *info = arg;
- struct snd_seq_client *cptr __free(snd_seq_client) = NULL;
- struct snd_seq_client_port *port __free(snd_seq_port) = NULL;
- cptr = client_load_and_use_ptr(info->addr.client);
+ struct snd_seq_client *cptr __free(snd_seq_client) =
+ client_load_and_use_ptr(info->addr.client);
if (cptr == NULL)
return -ENXIO;
/* search for next port */
info->addr.port++;
- port = snd_seq_port_query_nearest(cptr, info);
+ struct snd_seq_client_port *port __free(snd_seq_port) =
+ snd_seq_port_query_nearest(cptr, info);
if (port == NULL)
return -ENOENT;
{
struct snd_seq_client_ump_info __user *argp =
(struct snd_seq_client_ump_info __user *)arg;
- struct snd_seq_client *cptr __free(snd_seq_client) = NULL;
int client, type, err = 0;
size_t size;
void *p;
size = sizeof(struct snd_ump_endpoint_info);
else
size = sizeof(struct snd_ump_block_info);
- cptr = client_load_and_use_ptr(client);
+
+ struct snd_seq_client *cptr __free(snd_seq_client) =
+ client_load_and_use_ptr(client);
if (!cptr)
return -ENOENT;
int snd_seq_kernel_client_enqueue(int client, struct snd_seq_event *ev,
struct file *file, bool blocking)
{
- struct snd_seq_client *cptr __free(snd_seq_client) = NULL;
-
if (snd_BUG_ON(!ev))
return -EINVAL;
if (check_event_type_and_length(ev))
return -EINVAL;
- cptr = client_load_and_use_ptr(client);
+ struct snd_seq_client *cptr __free(snd_seq_client) =
+ client_load_and_use_ptr(client);
if (cptr == NULL)
return -EINVAL;
int snd_seq_kernel_client_dispatch(int client, struct snd_seq_event * ev,
int atomic, int hop)
{
- struct snd_seq_client *cptr __free(snd_seq_client) = NULL;
-
if (snd_BUG_ON(!ev))
return -EINVAL;
if (check_event_type_and_length(ev))
return -EINVAL;
- cptr = snd_seq_client_use_ptr(client);
+ struct snd_seq_client *cptr __free(snd_seq_client) =
+ snd_seq_client_use_ptr(client);
if (cptr == NULL)
return -EINVAL;
/* a similar like above but taking locks; used only from OSS sequencer layer */
int snd_seq_kernel_client_ioctl(int clientid, unsigned int cmd, void *arg)
{
- struct snd_seq_client *client __free(snd_seq_client) = NULL;
+ struct snd_seq_client *client __free(snd_seq_client) =
+ client_load_and_use_ptr(clientid);
- client = client_load_and_use_ptr(clientid);
if (!client)
return -ENXIO;
guard(mutex)(&client->ioctl_mutex);
/* list the client table */
for (c = 0; c < SNDRV_SEQ_MAX_CLIENTS; c++) {
- struct snd_seq_client *client __free(snd_seq_client) = NULL;
+ struct snd_seq_client *client __free(snd_seq_client) =
+ client_load_and_use_ptr(c);
- client = client_load_and_use_ptr(c);
if (client == NULL)
continue;
if (client->type == NO_CLIENT)