*r_handle = NULL;
if ((err = snd_ctl_open(&ctl_handle, card)) < 0)
return err;
+ handle = (snd_mixer_t *) calloc(1, sizeof(snd_mixer_t));
+ if (handle == NULL) {
+ snd_ctl_close(ctl_handle);
+ return -ENOMEM;
+ }
if ((err = snd_ctl_hcallback_rebuild(ctl_handle, snd_mixer_simple_read_rebuild, handle)) < 0) {
snd_ctl_close(ctl_handle);
+ free(handle);
return err;
}
if ((err = snd_ctl_hcallback_add(ctl_handle, snd_mixer_simple_read_add, handle)) < 0) {
snd_ctl_close(ctl_handle);
+ free(handle);
return err;
}
- handle = (snd_mixer_t *) calloc(1, sizeof(snd_mixer_t));
- if (handle == NULL) {
- snd_ctl_close(ctl_handle);
- return -ENOMEM;
- }
handle->ctl_handle = ctl_handle;
INIT_LIST_HEAD(&handle->simples);
*r_handle = handle;
struct list_head *lh;
mixer_simple_t *s;
snd_mixer_sid_t *p;
- int err, idx;
+ int err;
+ unsigned int idx;
if (handle == NULL || list == NULL)
return -EINVAL;
handle->simple_changes++;
}
-static void snd_mixer_simple_read_add(snd_ctl_t *ctl_handle, void *private_data, snd_hcontrol_t *hcontrol)
+static void snd_mixer_simple_read_add(snd_ctl_t *ctl_handle ATTRIBUTE_UNUSED, void *private_data, snd_hcontrol_t *hcontrol)
{
snd_mixer_t *handle = (snd_mixer_t *)private_data;
mixer_simple_t *s;
return s;
}
-static void hcontrol_event_change(snd_ctl_t *ctl_handle, snd_hcontrol_t *hcontrol)
+static void hcontrol_event_change(snd_ctl_t *ctl_handle ATTRIBUTE_UNUSED, snd_hcontrol_t *hcontrol ATTRIBUTE_UNUSED)
{
/* ignore at this moment */
}
-static void hcontrol_event_value(snd_ctl_t *ctl_handle, snd_hcontrol_t *hcontrol)
+static void hcontrol_event_value(snd_ctl_t *ctl_handle ATTRIBUTE_UNUSED, snd_hcontrol_t *hcontrol)
{
snd_mixer_t *handle = (snd_mixer_t *)hcontrol->private_data;
mixer_simple_t *s;
}
}
-static void hcontrol_event_remove(snd_ctl_t *ctl_handle, snd_hcontrol_t *hcontrol)
+static void hcontrol_event_remove(snd_ctl_t *ctl_handle ATTRIBUTE_UNUSED, snd_hcontrol_t *hcontrol ATTRIBUTE_UNUSED)
{
/* ignore at this moment */
}
min = max = 0;
bag = NULL;
sprintf(str, "%s Switch", sname);
- if (hcontrol = test_mixer_id(handle, str, index)) {
+ if ((hcontrol = test_mixer_id(handle, str, index)) != NULL) {
if ((err = get_mixer_info(handle, str, index, &gswitch_info)) < 0)
return err;
if (gswitch_info.type == SND_CONTROL_TYPE_BOOLEAN) {
}
}
sprintf(str, "%s Volume", sname);
- if (hcontrol = test_mixer_id(handle, str, index)) {
+ if ((hcontrol = test_mixer_id(handle, str, index)) != NULL) {
if ((err = get_mixer_info(handle, str, index, &gvolume_info)) < 0)
return err;
if (gvolume_info.type == SND_CONTROL_TYPE_INTEGER) {
}
}
sprintf(str, "%s Playback Switch", sname);
- if (hcontrol = test_mixer_id(handle, str, index)) {
+ if ((hcontrol = test_mixer_id(handle, str, index)) != NULL) {
if ((err = get_mixer_info(handle, str, index, &pswitch_info)) < 0)
return err;
if (pswitch_info.type == SND_CONTROL_TYPE_BOOLEAN) {
}
}
sprintf(str, "%s Capture Switch", sname);
- if (hcontrol = test_mixer_id(handle, str, index)) {
+ if ((hcontrol = test_mixer_id(handle, str, index)) != NULL) {
if ((err = get_mixer_info(handle, str, index, &cswitch_info)) < 0)
return err;
if (cswitch_info.type == SND_CONTROL_TYPE_BOOLEAN) {
}
}
sprintf(str, "%s Playback Volume", sname);
- if (hcontrol = test_mixer_id(handle, str, index)) {
+ if ((hcontrol = test_mixer_id(handle, str, index)) != NULL) {
if ((err = get_mixer_info(handle, str, index, &pvolume_info)) < 0)
return err;
if (pvolume_info.type == SND_CONTROL_TYPE_INTEGER) {
}
}
sprintf(str, "%s Capture Volume", sname);
- if (hcontrol = test_mixer_id(handle, str, index)) {
+ if ((hcontrol = test_mixer_id(handle, str, index)) != NULL) {
if ((err = get_mixer_info(handle, str, index, &cvolume_info)) < 0)
return err;
if (cvolume_info.type == SND_CONTROL_TYPE_INTEGER) {