]> git.alsa-project.org Git - alsa-lib.git/commitdiff
pcm: ioplug,extplug: Fix logic errors in type checks
authorTakashi Iwai <tiwai@suse.de>
Tue, 8 Sep 2015 18:57:47 +0000 (20:57 +0200)
committerTakashi Iwai <tiwai@suse.de>
Tue, 8 Sep 2015 18:57:47 +0000 (20:57 +0200)
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>
src/pcm/pcm_extplug.c
src/pcm/pcm_ioplug.c

index a5de6d848e2160c50a352d6559883ef00931ea67..a04f826c90a010a75c66d007aa1a7d206c99db5a 100644 (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)
 {
        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);
                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)
 {
        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);
                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)
 {
        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);
                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)
 {
        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);
                return -EINVAL;
        }
index fe9347c835d54afd51f226d965828b7db9a6c39c..43550c03875b5894ef45638e8f43468effa45b40 100644 (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)
 {
        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);
                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)
 {
        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);
                return -EINVAL;
        }