if (ret == 0)
return;
- if (ret < 0 || powd->fd < 0)
+ if (ret < 0 || !powd)
return sched_min_delay(s);
para_fd_set(powd->fd, &s->wfds, &s->max_fileno);
}
{
struct private_oss_write_data *powd = wn->private_data;
- if (powd->fd >= 0)
- close(powd->fd);
+ if (!powd)
+ return;
+ close(powd->fd);
free(powd);
}
int ret, format;
unsigned ch, rate;
struct oss_write_args_info *conf = wn->conf;
- struct private_oss_write_data *powd = wn->private_data;
+ struct private_oss_write_data *powd = para_calloc(sizeof(*powd));
+ wn->private_data = powd;
PARA_INFO_LOG("opening %s\n", conf->device_arg);
ret = para_open(conf->device_arg, O_WRONLY, 0);
if (ret < 0)
- return ret;
+ goto err_free;
powd->fd = ret;
ret = mark_fd_nonblocking(powd->fd);
if (ret < 0)
return 1;
err:
close(powd->fd);
- powd->fd = -1;
+err_free:
+ free(powd);
return ret;
}
goto out;
if (ret == 0)
return;
- if (powd->fd < 0) {
+ if (!powd) {
int32_t rate, ch, format;
get_btr_sample_rate(btrn, &rate);
get_btr_channels(btrn, &ch);
btr_remove_node(btrn);
}
-static void oss_open(struct writer_node *wn)
+static void oss_open(__a_unused struct writer_node *wn)
{
- struct private_oss_write_data *powd = para_calloc(sizeof(*powd));
-
- powd->fd = -1;
- wn->private_data = powd;
}
__malloc static void *oss_parse_config_or_die(const char *options)