sound: remove redundant tests on unsigned
Subsystems (3)
PATCH 1/1 sound: remove redundant tests on unsigned
reg and channel_id are unsigned. When negative they are wrapped and caught by the other test.
Signed-off-by Roel Kluin <[email protected]>
--- sound/pci/ca0106/ca0106_proc.c | 2 +- sound/pci/emu10k1/emu10k1x.c | 3 +-- sound/pci/emu10k1/emuproc.c | 2 +- sound/soc/codecs/tlv320aic23.c | 2 +- 4 files changed, 4 insertions(+), 5 deletions(-)
sound/pci/ca0106/ca0106_proc.c +1 -1
@@ -304,7 +304,7 @@ static void snd_ca0106_proc_reg_write32(struct snd_info_entry *entry,while (!snd_info_get_line (buffer, line,sizeof (line))) {if (sscanf (line,"%x %x" , ®, &val) !=2 )continue ; -if ((reg <0x40 ) && (reg >=0 ) && (val <=0xffffffff ) ) { +if ((reg <0x40 ) && (val <=0xffffffff )) {spin_lock_irqsave (&emu->emu_lock, flags);outl (val, emu->port + (reg &0xfffffffc ));spin_unlock_irqrestore (&emu->emu_lock, flags);
sound/pci/emu10k1/emu10k1x.c +1 -2
@@ -1040,8 +1040,7 @@ static void snd_emu10k1x_proc_reg_write(struct snd_info_entry *entry,if (sscanf (line,"%x %x %x" , ®, &channel_id, &val) !=3 )continue ; -if ((reg <0x49 ) && (reg >=0 ) && (val <=0xffffffff ) - && (channel_id >=0 ) && (channel_id <=2 ) ) +if ((reg <0x49 ) && (val <=0xffffffff ) && (channel_id <=2 ))snd_emu10k1x_ptr_write (emu, reg, channel_id, val); } }
sound/pci/emu10k1/emuproc.c +1 -1
@@ -527,7 +527,7 @@ static void snd_emu_proc_ptr_reg_write(struct snd_info_entry *entry,while (!snd_info_get_line (buffer, line,sizeof (line))) {if (sscanf (line,"%x %x %x" , ®, &channel_id, &val) !=3 )continue ; -if ((reg <0xa0 ) && (reg >=0 ) && (val <=0xffffffff ) && (channel_id >=0 ) && (channel_id <=3 ) ) +if ((reg <0xa0 ) && (val <=0xffffffff ) && (channel_id <=3 ))snd_ptr_write (emu, iobase, reg, channel_id, val); } }
sound/soc/codecs/tlv320aic23.c +1 -1
@@ -85,7 +85,7 @@ static int tlv320aic23_write(struct snd_soc_codec *codec, unsigned int reg,* of data into val */ -if ((reg <0 || reg >9 ) && (reg !=15 )) { +if ((reg >9 ) && (reg !=15 )) {printk (KERN_WARNING "%s Invalid register R%u\n" , __func__, reg);return -1 ; }
At Mon, 22 Jun 2009 17:58:27 +0200,
Quoted 5 lines · Roel Kluin
reg and
channel_idare unsigned. When negative they are wrapped and caught by the other test.Signed-off-by Roel Kluin <[email protected]>
This seems unable to apply to the latest tree.
Could you rebase?
thanks,
Takashi
Quoted 61 lines
--- sound/pci/ca0106/ca0106_proc.c | 2 +- sound/pci/emu10k1/emu10k1x.c | 3 +-- sound/pci/emu10k1/emuproc.c | 2 +- sound/soc/codecs/tlv320aic23.c | 2 +- 4 files changed, 4 insertions(+), 5 deletions(-)sound/pci/ca0106/ca0106_proc.c +1
-1@@ -304,7 +304,7 @@ static void snd_ca0106_proc_reg_write32(struct snd_info_entry *entry,while (!snd_info_get_line (buffer, line,sizeof (line))) {if (sscanf (line,"%x %x" , ®, &val) !=2 )continue ; -if ((reg <0x40 ) && (reg >=0 ) && (val <=0xffffffff ) ) { +if ((reg <0x40 ) && (val <=0xffffffff )) {spin_lock_irqsave (&emu->emu_lock, flags);outl (val, emu->port + (reg &0xfffffffc ));spin_unlock_irqrestore (&emu->emu_lock, flags);sound/pci/emu10k1/emu10k1x.c +1
-2@@ -1040,8 +1040,7 @@ static void snd_emu10k1x_proc_reg_write(struct snd_info_entry *entry,if (sscanf (line,"%x %x %x" , ®, &channel_id, &val) !=3 )continue ; -if ((reg <0x49 ) && (reg >=0 ) && (val <=0xffffffff ) - && (channel_id >=0 ) && (channel_id <=2 ) ) +if ((reg <0x49 ) && (val <=0xffffffff ) && (channel_id <=2 ))snd_emu10k1x_ptr_write (emu, reg, channel_id, val); } }sound/pci/emu10k1/emuproc.c +1
-1@@ -527,7 +527,7 @@ static void snd_emu_proc_ptr_reg_write(struct snd_info_entry *entry,while (!snd_info_get_line (buffer, line,sizeof (line))) {if (sscanf (line,"%x %x %x" , ®, &channel_id, &val) !=3 )continue ; -if ((reg <0xa0 ) && (reg >=0 ) && (val <=0xffffffff ) && (channel_id >=0 ) && (channel_id <=3 ) ) +if ((reg <0xa0 ) && (val <=0xffffffff ) && (channel_id <=3 ))snd_ptr_write (emu, iobase, reg, channel_id, val); } }sound/soc/codecs/tlv320aic23.c +1
-1@@ -85,7 +85,7 @@ static int tlv320aic23_write(struct snd_soc_codec *codec, unsigned int reg,* of data into val */ -if ((reg <0 || reg >9 ) && (reg !=15 )) { +if ((reg >9 ) && (reg !=15 )) {printk (KERN_WARNING "%s Invalid register R%u\n" , __func__, reg);return -1 ; }