aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoel Kluin <roel.kluin@gmail.com>2009-10-23 10:03:08 -0400
committerTakashi Iwai <tiwai@suse.de>2009-10-30 07:25:07 -0400
commit84ed1a1942e8c28fb4c23a6235ec48672fc43e49 (patch)
tree67b0d7a9c639cddd9cb6319ed67e0c0d6a680dd7
parenta688e4885c1aa6b88ab5ffa64655bacc01749c9e (diff)
ALSA: Cleanup redundant tests on unsigned
The variables are unsigned so the test `>= 0' is always true, the `< 0' test always fails. In these cases the other part of the test catches wrapped values. In dac_audio_write() there does not occur a test for wrapped values, but the test appears redundant. Signed-off-by: Roel Kluin <roel.kluin@gmail.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r--sound/oss/sh_dac_audio.c3
-rw-r--r--sound/pci/ca0106/ca0106_proc.c4
-rw-r--r--sound/pci/ctxfi/ctatc.c2
-rw-r--r--sound/pci/emu10k1/emu10k1x.c3
-rw-r--r--sound/pci/emu10k1/emuproc.c4
-rw-r--r--sound/pci/emu10k1/io.c2
-rw-r--r--sound/soc/codecs/tlv320aic23.c2
7 files changed, 8 insertions, 12 deletions
diff --git a/sound/oss/sh_dac_audio.c b/sound/oss/sh_dac_audio.c
index b2ed8757542a..4153752507e3 100644
--- a/sound/oss/sh_dac_audio.c
+++ b/sound/oss/sh_dac_audio.c
@@ -164,9 +164,6 @@ static ssize_t dac_audio_write(struct file *file, const char *buf, size_t count,
164 int free; 164 int free;
165 int nbytes; 165 int nbytes;
166 166
167 if (count < 0)
168 return -EINVAL;
169
170 if (!count) { 167 if (!count) {
171 dac_audio_sync(); 168 dac_audio_sync();
172 return 0; 169 return 0;
diff --git a/sound/pci/ca0106/ca0106_proc.c b/sound/pci/ca0106/ca0106_proc.c
index c62b7d10ec61..15523e60351c 100644
--- a/sound/pci/ca0106/ca0106_proc.c
+++ b/sound/pci/ca0106/ca0106_proc.c
@@ -304,7 +304,7 @@ static void snd_ca0106_proc_reg_write32(struct snd_info_entry *entry,
304 while (!snd_info_get_line(buffer, line, sizeof(line))) { 304 while (!snd_info_get_line(buffer, line, sizeof(line))) {
305 if (sscanf(line, "%x %x", &reg, &val) != 2) 305 if (sscanf(line, "%x %x", &reg, &val) != 2)
306 continue; 306 continue;
307 if ((reg < 0x40) && (reg >=0) && (val <= 0xffffffff) ) { 307 if (reg < 0x40 && val <= 0xffffffff) {
308 spin_lock_irqsave(&emu->emu_lock, flags); 308 spin_lock_irqsave(&emu->emu_lock, flags);
309 outl(val, emu->port + (reg & 0xfffffffc)); 309 outl(val, emu->port + (reg & 0xfffffffc));
310 spin_unlock_irqrestore(&emu->emu_lock, flags); 310 spin_unlock_irqrestore(&emu->emu_lock, flags);
@@ -405,7 +405,7 @@ static void snd_ca0106_proc_reg_write(struct snd_info_entry *entry,
405 while (!snd_info_get_line(buffer, line, sizeof(line))) { 405 while (!snd_info_get_line(buffer, line, sizeof(line))) {
406 if (sscanf(line, "%x %x %x", &reg, &channel_id, &val) != 3) 406 if (sscanf(line, "%x %x %x", &reg, &channel_id, &val) != 3)
407 continue; 407 continue;
408 if ((reg < 0x80) && (reg >=0) && (val <= 0xffffffff) && (channel_id >=0) && (channel_id <= 3) ) 408 if (reg < 0x80 && val <= 0xffffffff && channel_id <= 3)
409 snd_ca0106_ptr_write(emu, reg, channel_id, val); 409 snd_ca0106_ptr_write(emu, reg, channel_id, val);
410 } 410 }
411} 411}
diff --git a/sound/pci/ctxfi/ctatc.c b/sound/pci/ctxfi/ctatc.c
index b1b3a644f738..6bfce99b42a2 100644
--- a/sound/pci/ctxfi/ctatc.c
+++ b/sound/pci/ctxfi/ctatc.c
@@ -240,7 +240,7 @@ static int select_rom(unsigned int pitch)
240 } else if (pitch == 0x02000000) { 240 } else if (pitch == 0x02000000) {
241 /* pitch == 2 */ 241 /* pitch == 2 */
242 return 3; 242 return 3;
243 } else if (pitch >= 0x0 && pitch <= 0x08000000) { 243 } else if (pitch <= 0x08000000) {
244 /* 0 <= pitch <= 8 */ 244 /* 0 <= pitch <= 8 */
245 return 0; 245 return 0;
246 } else { 246 } else {
diff --git a/sound/pci/emu10k1/emu10k1x.c b/sound/pci/emu10k1/emu10k1x.c
index 36e08bd2b3cc..6b8ae7b5cd54 100644
--- a/sound/pci/emu10k1/emu10k1x.c
+++ b/sound/pci/emu10k1/emu10k1x.c
@@ -1040,8 +1040,7 @@ static void snd_emu10k1x_proc_reg_write(struct snd_info_entry *entry,
1040 if (sscanf(line, "%x %x %x", &reg, &channel_id, &val) != 3) 1040 if (sscanf(line, "%x %x %x", &reg, &channel_id, &val) != 3)
1041 continue; 1041 continue;
1042 1042
1043 if ((reg < 0x49) && (reg >= 0) && (val <= 0xffffffff) 1043 if (reg < 0x49 && val <= 0xffffffff && channel_id <= 2)
1044 && (channel_id >= 0) && (channel_id <= 2) )
1045 snd_emu10k1x_ptr_write(emu, reg, channel_id, val); 1044 snd_emu10k1x_ptr_write(emu, reg, channel_id, val);
1046 } 1045 }
1047} 1046}
diff --git a/sound/pci/emu10k1/emuproc.c b/sound/pci/emu10k1/emuproc.c
index 216f9748aff5..baa7cd508cd8 100644
--- a/sound/pci/emu10k1/emuproc.c
+++ b/sound/pci/emu10k1/emuproc.c
@@ -451,7 +451,7 @@ static void snd_emu_proc_io_reg_write(struct snd_info_entry *entry,
451 while (!snd_info_get_line(buffer, line, sizeof(line))) { 451 while (!snd_info_get_line(buffer, line, sizeof(line))) {
452 if (sscanf(line, "%x %x", &reg, &val) != 2) 452 if (sscanf(line, "%x %x", &reg, &val) != 2)
453 continue; 453 continue;
454 if ((reg < 0x40) && (reg >= 0) && (val <= 0xffffffff) ) { 454 if (reg < 0x40 && val <= 0xffffffff) {
455 spin_lock_irqsave(&emu->emu_lock, flags); 455 spin_lock_irqsave(&emu->emu_lock, flags);
456 outl(val, emu->port + (reg & 0xfffffffc)); 456 outl(val, emu->port + (reg & 0xfffffffc));
457 spin_unlock_irqrestore(&emu->emu_lock, flags); 457 spin_unlock_irqrestore(&emu->emu_lock, flags);
@@ -527,7 +527,7 @@ static void snd_emu_proc_ptr_reg_write(struct snd_info_entry *entry,
527 while (!snd_info_get_line(buffer, line, sizeof(line))) { 527 while (!snd_info_get_line(buffer, line, sizeof(line))) {
528 if (sscanf(line, "%x %x %x", &reg, &channel_id, &val) != 3) 528 if (sscanf(line, "%x %x %x", &reg, &channel_id, &val) != 3)
529 continue; 529 continue;
530 if ((reg < 0xa0) && (reg >= 0) && (val <= 0xffffffff) && (channel_id >= 0) && (channel_id <= 3) ) 530 if (reg < 0xa0 && val <= 0xffffffff && channel_id <= 3)
531 snd_ptr_write(emu, iobase, reg, channel_id, val); 531 snd_ptr_write(emu, iobase, reg, channel_id, val);
532 } 532 }
533} 533}
diff --git a/sound/pci/emu10k1/io.c b/sound/pci/emu10k1/io.c
index c1a5aa15af8f..5ef7080e14d0 100644
--- a/sound/pci/emu10k1/io.c
+++ b/sound/pci/emu10k1/io.c
@@ -256,7 +256,7 @@ int snd_emu1010_fpga_write(struct snd_emu10k1 * emu, u32 reg, u32 value)
256 if (reg > 0x3f) 256 if (reg > 0x3f)
257 return 1; 257 return 1;
258 reg += 0x40; /* 0x40 upwards are registers. */ 258 reg += 0x40; /* 0x40 upwards are registers. */
259 if (value < 0 || value > 0x3f) /* 0 to 0x3f are values */ 259 if (value > 0x3f) /* 0 to 0x3f are values */
260 return 1; 260 return 1;
261 spin_lock_irqsave(&emu->emu_lock, flags); 261 spin_lock_irqsave(&emu->emu_lock, flags);
262 outl(reg, emu->port + A_IOCFG); 262 outl(reg, emu->port + A_IOCFG);
diff --git a/sound/soc/codecs/tlv320aic23.c b/sound/soc/codecs/tlv320aic23.c
index 0b8dcb5cd729..35606ae60868 100644
--- a/sound/soc/codecs/tlv320aic23.c
+++ b/sound/soc/codecs/tlv320aic23.c
@@ -85,7 +85,7 @@ static int tlv320aic23_write(struct snd_soc_codec *codec, unsigned int reg,
85 * of data into val 85 * of data into val
86 */ 86 */
87 87
88 if ((reg < 0 || reg > 9) && (reg != 15)) { 88 if (reg > 9 && reg != 15) {
89 printk(KERN_WARNING "%s Invalid register R%u\n", __func__, reg); 89 printk(KERN_WARNING "%s Invalid register R%u\n", __func__, reg);
90 return -1; 90 return -1;
91 } 91 }