Commit d60229d8 authored by Colin Ian King's avatar Colin Ian King Committed by Takashi Iwai

ALSA: cs4236: fix error return comparison of an unsigned integer

The return from pnp_irq is an unsigned integer type resource_size_t
and hence the error check for a positive non-error code is always
going to be true.  A check for a non-failure return from pnp_irq
should in fact be for (resource_size_t)-1 rather than >= 0.

Addresses-Coverity: ("Unsigned compared against 0")
Fixes: a9824c86 ("[ALSA] Add CS4232 PnP BIOS support")
Signed-off-by: default avatarColin Ian King <colin.king@canonical.com>
Link: https://lore.kernel.org/r/20191122131354.58042-1-colin.king@canonical.comSigned-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 9435f2bb
...@@ -278,7 +278,8 @@ static int snd_cs423x_pnp_init_mpu(int dev, struct pnp_dev *pdev) ...@@ -278,7 +278,8 @@ static int snd_cs423x_pnp_init_mpu(int dev, struct pnp_dev *pdev)
} else { } else {
mpu_port[dev] = pnp_port_start(pdev, 0); mpu_port[dev] = pnp_port_start(pdev, 0);
if (mpu_irq[dev] >= 0 && if (mpu_irq[dev] >= 0 &&
pnp_irq_valid(pdev, 0) && pnp_irq(pdev, 0) >= 0) { pnp_irq_valid(pdev, 0) &&
pnp_irq(pdev, 0) != (resource_size_t)-1) {
mpu_irq[dev] = pnp_irq(pdev, 0); mpu_irq[dev] = pnp_irq(pdev, 0);
} else { } else {
mpu_irq[dev] = -1; /* disable interrupt */ mpu_irq[dev] = -1; /* disable interrupt */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment