pcm: ioplug,extplug: Fix logic errors in type checks

A few error checks are wrongly performed with logical and (&&) instead
of logical or (||), which condition never met.

Reported-by: David Binderman <dcb314@hotmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
Takashi Iwai 2015-09-08 20:57:47 +02:00
parent 3313f8740d
commit fe8bb1fe02
2 changed files with 6 additions and 6 deletions

View file

@ -766,7 +766,7 @@ void snd_pcm_extplug_params_reset(snd_pcm_extplug_t *extplug)
int snd_pcm_extplug_set_slave_param_list(snd_pcm_extplug_t *extplug, int type, unsigned int num_list, const unsigned int *list) int snd_pcm_extplug_set_slave_param_list(snd_pcm_extplug_t *extplug, int type, unsigned int num_list, const unsigned int *list)
{ {
extplug_priv_t *ext = extplug->pcm->private_data; extplug_priv_t *ext = extplug->pcm->private_data;
if (type < 0 && type >= SND_PCM_EXTPLUG_HW_PARAMS) { if (type < 0 || type >= SND_PCM_EXTPLUG_HW_PARAMS) {
SNDERR("EXTPLUG: invalid parameter type %d", type); SNDERR("EXTPLUG: invalid parameter type %d", type);
return -EINVAL; return -EINVAL;
} }
@ -788,7 +788,7 @@ int snd_pcm_extplug_set_slave_param_list(snd_pcm_extplug_t *extplug, int type, u
int snd_pcm_extplug_set_slave_param_minmax(snd_pcm_extplug_t *extplug, int type, unsigned int min, unsigned int max) int snd_pcm_extplug_set_slave_param_minmax(snd_pcm_extplug_t *extplug, int type, unsigned int min, unsigned int max)
{ {
extplug_priv_t *ext = extplug->pcm->private_data; extplug_priv_t *ext = extplug->pcm->private_data;
if (type < 0 && type >= SND_PCM_EXTPLUG_HW_PARAMS) { if (type < 0 || type >= SND_PCM_EXTPLUG_HW_PARAMS) {
SNDERR("EXTPLUG: invalid parameter type %d", type); SNDERR("EXTPLUG: invalid parameter type %d", type);
return -EINVAL; return -EINVAL;
} }
@ -814,7 +814,7 @@ int snd_pcm_extplug_set_slave_param_minmax(snd_pcm_extplug_t *extplug, int type,
int snd_pcm_extplug_set_param_list(snd_pcm_extplug_t *extplug, int type, unsigned int num_list, const unsigned int *list) int snd_pcm_extplug_set_param_list(snd_pcm_extplug_t *extplug, int type, unsigned int num_list, const unsigned int *list)
{ {
extplug_priv_t *ext = extplug->pcm->private_data; extplug_priv_t *ext = extplug->pcm->private_data;
if (type < 0 && type >= SND_PCM_EXTPLUG_HW_PARAMS) { if (type < 0 || type >= SND_PCM_EXTPLUG_HW_PARAMS) {
SNDERR("EXTPLUG: invalid parameter type %d", type); SNDERR("EXTPLUG: invalid parameter type %d", type);
return -EINVAL; return -EINVAL;
} }
@ -836,7 +836,7 @@ int snd_pcm_extplug_set_param_list(snd_pcm_extplug_t *extplug, int type, unsigne
int snd_pcm_extplug_set_param_minmax(snd_pcm_extplug_t *extplug, int type, unsigned int min, unsigned int max) int snd_pcm_extplug_set_param_minmax(snd_pcm_extplug_t *extplug, int type, unsigned int min, unsigned int max)
{ {
extplug_priv_t *ext = extplug->pcm->private_data; extplug_priv_t *ext = extplug->pcm->private_data;
if (type < 0 && type >= SND_PCM_EXTPLUG_HW_PARAMS) { if (type < 0 || type >= SND_PCM_EXTPLUG_HW_PARAMS) {
SNDERR("EXTPLUG: invalid parameter type %d", type); SNDERR("EXTPLUG: invalid parameter type %d", type);
return -EINVAL; return -EINVAL;
} }

View file

@ -1019,7 +1019,7 @@ void snd_pcm_ioplug_params_reset(snd_pcm_ioplug_t *ioplug)
int snd_pcm_ioplug_set_param_list(snd_pcm_ioplug_t *ioplug, int type, unsigned int num_list, const unsigned int *list) int snd_pcm_ioplug_set_param_list(snd_pcm_ioplug_t *ioplug, int type, unsigned int num_list, const unsigned int *list)
{ {
ioplug_priv_t *io = ioplug->pcm->private_data; ioplug_priv_t *io = ioplug->pcm->private_data;
if (type < 0 && type >= SND_PCM_IOPLUG_HW_PARAMS) { if (type < 0 || type >= SND_PCM_IOPLUG_HW_PARAMS) {
SNDERR("IOPLUG: invalid parameter type %d", type); SNDERR("IOPLUG: invalid parameter type %d", type);
return -EINVAL; return -EINVAL;
} }
@ -1043,7 +1043,7 @@ int snd_pcm_ioplug_set_param_list(snd_pcm_ioplug_t *ioplug, int type, unsigned i
int snd_pcm_ioplug_set_param_minmax(snd_pcm_ioplug_t *ioplug, int type, unsigned int min, unsigned int max) int snd_pcm_ioplug_set_param_minmax(snd_pcm_ioplug_t *ioplug, int type, unsigned int min, unsigned int max)
{ {
ioplug_priv_t *io = ioplug->pcm->private_data; ioplug_priv_t *io = ioplug->pcm->private_data;
if (type < 0 && type >= SND_PCM_IOPLUG_HW_PARAMS) { if (type < 0 || type >= SND_PCM_IOPLUG_HW_PARAMS) {
SNDERR("IOPLUG: invalid parameter type %d", type); SNDERR("IOPLUG: invalid parameter type %d", type);
return -EINVAL; return -EINVAL;
} }