control_shm: remove duplicate code (coverity)

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
Jaroslav Kysela 2019-05-24 10:51:47 +02:00
parent 990b1a53ed
commit 51881cacc0

View file

@ -302,13 +302,9 @@ static int snd_ctl_shm_pcm_prefer_subdevice(snd_ctl_t *ctl, int subdev)
{ {
snd_ctl_shm_t *shm = ctl->private_data; snd_ctl_shm_t *shm = ctl->private_data;
volatile snd_ctl_shm_ctrl_t *ctrl = shm->ctrl; volatile snd_ctl_shm_ctrl_t *ctrl = shm->ctrl;
int err;
ctrl->u.pcm_prefer_subdevice = subdev; ctrl->u.pcm_prefer_subdevice = subdev;
ctrl->cmd = SNDRV_CTL_IOCTL_PCM_PREFER_SUBDEVICE; ctrl->cmd = SNDRV_CTL_IOCTL_PCM_PREFER_SUBDEVICE;
err = snd_ctl_shm_action(ctl); return snd_ctl_shm_action(ctl);
if (err < 0)
return err;
return err;
} }
static int snd_ctl_shm_rawmidi_next_device(snd_ctl_t *ctl, int * device) static int snd_ctl_shm_rawmidi_next_device(snd_ctl_t *ctl, int * device)
@ -343,26 +339,18 @@ static int snd_ctl_shm_rawmidi_prefer_subdevice(snd_ctl_t *ctl, int subdev)
{ {
snd_ctl_shm_t *shm = ctl->private_data; snd_ctl_shm_t *shm = ctl->private_data;
volatile snd_ctl_shm_ctrl_t *ctrl = shm->ctrl; volatile snd_ctl_shm_ctrl_t *ctrl = shm->ctrl;
int err;
ctrl->u.rawmidi_prefer_subdevice = subdev; ctrl->u.rawmidi_prefer_subdevice = subdev;
ctrl->cmd = SNDRV_CTL_IOCTL_RAWMIDI_PREFER_SUBDEVICE; ctrl->cmd = SNDRV_CTL_IOCTL_RAWMIDI_PREFER_SUBDEVICE;
err = snd_ctl_shm_action(ctl); return snd_ctl_shm_action(ctl);
if (err < 0)
return err;
return err;
} }
static int snd_ctl_shm_set_power_state(snd_ctl_t *ctl, unsigned int state) static int snd_ctl_shm_set_power_state(snd_ctl_t *ctl, unsigned int state)
{ {
snd_ctl_shm_t *shm = ctl->private_data; snd_ctl_shm_t *shm = ctl->private_data;
volatile snd_ctl_shm_ctrl_t *ctrl = shm->ctrl; volatile snd_ctl_shm_ctrl_t *ctrl = shm->ctrl;
int err;
ctrl->u.power_state = state; ctrl->u.power_state = state;
ctrl->cmd = SNDRV_CTL_IOCTL_POWER; ctrl->cmd = SNDRV_CTL_IOCTL_POWER;
err = snd_ctl_shm_action(ctl); return snd_ctl_shm_action(ctl);
if (err < 0)
return err;
return err;
} }
static int snd_ctl_shm_get_power_state(snd_ctl_t *ctl, unsigned int *state) static int snd_ctl_shm_get_power_state(snd_ctl_t *ctl, unsigned int *state)