* [PATCH] sound: remove redundant tests on unsigned
@ 2009-06-22 15:58 Roel Kluin
2009-06-22 16:27 ` Takashi Iwai
0 siblings, 1 reply; 2+ messages in thread
From: Roel Kluin @ 2009-06-22 15:58 UTC (permalink / raw)
To: tiwai, lrg; +Cc: alsa-devel, Andrew Morton
reg and channel_id are unsigned. When negative they are wrapped and caught by
the other test.
Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
---
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(-)
diff --git a/sound/pci/ca0106/ca0106_proc.c b/sound/pci/ca0106/ca0106_proc.c
index c62b7d1..2deac54 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,
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);
diff --git a/sound/pci/emu10k1/emu10k1x.c b/sound/pci/emu10k1/emu10k1x.c
index 4d3ad79..957b130 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,
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);
}
}
diff --git a/sound/pci/emu10k1/emuproc.c b/sound/pci/emu10k1/emuproc.c
index 216f974..6ad3825 100644
--- a/sound/pci/emu10k1/emuproc.c
+++ b/sound/pci/emu10k1/emuproc.c
@@ -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);
}
}
diff --git a/sound/soc/codecs/tlv320aic23.c b/sound/soc/codecs/tlv320aic23.c
index 0b8dcb5..6f8cd8d 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,
* 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;
}
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] sound: remove redundant tests on unsigned
2009-06-22 15:58 [PATCH] sound: remove redundant tests on unsigned Roel Kluin
@ 2009-06-22 16:27 ` Takashi Iwai
0 siblings, 0 replies; 2+ messages in thread
From: Takashi Iwai @ 2009-06-22 16:27 UTC (permalink / raw)
To: Roel Kluin; +Cc: alsa-devel, Andrew Morton, lrg
At Mon, 22 Jun 2009 17:58:27 +0200,
Roel Kluin wrote:
>
> reg and channel_id are unsigned. When negative they are wrapped and caught by
> the other test.
>
> Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
This seems unable to apply to the latest tree.
Could you rebase?
thanks,
Takashi
> ---
> 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(-)
>
> diff --git a/sound/pci/ca0106/ca0106_proc.c b/sound/pci/ca0106/ca0106_proc.c
> index c62b7d1..2deac54 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,
> 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);
> diff --git a/sound/pci/emu10k1/emu10k1x.c b/sound/pci/emu10k1/emu10k1x.c
> index 4d3ad79..957b130 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,
> 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);
> }
> }
> diff --git a/sound/pci/emu10k1/emuproc.c b/sound/pci/emu10k1/emuproc.c
> index 216f974..6ad3825 100644
> --- a/sound/pci/emu10k1/emuproc.c
> +++ b/sound/pci/emu10k1/emuproc.c
> @@ -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);
> }
> }
> diff --git a/sound/soc/codecs/tlv320aic23.c b/sound/soc/codecs/tlv320aic23.c
> index 0b8dcb5..6f8cd8d 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,
> * 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;
> }
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-06-22 16:27 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-22 15:58 [PATCH] sound: remove redundant tests on unsigned Roel Kluin
2009-06-22 16:27 ` Takashi Iwai
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.