mirror of
				https://github.com/alsa-project/alsa-lib.git
				synced 2025-11-03 09:01:52 -05:00 
			
		
		
		
	control_shm: remove duplicate code (coverity)
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
		
							parent
							
								
									990b1a53ed
								
							
						
					
					
						commit
						51881cacc0
					
				
					 1 changed files with 3 additions and 15 deletions
				
			
		| 
						 | 
					@ -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)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue