summaryrefslogtreecommitdiff
path: root/src/southbridge/intel/i82801ix/azalia.c
diff options
context:
space:
mode:
authorAngel Pons <th3fanbus@gmail.com>2020-10-24 23:23:07 +0200
committerPatrick Georgi <pgeorgi@google.com>2020-11-02 10:41:15 +0000
commit554713ee0a32cd8eabd75b276aeb82aa2570b030 (patch)
tree48492cb71a23d95d7d7e0b798a0d95f01a9fb82e /src/southbridge/intel/i82801ix/azalia.c
parent90cdf705aa36f51a997c9bf81cf40ae159b3ce46 (diff)
azalia: Treat all negative return values as errors
Instead of checking whether the return value equals -1, just check if it is negative. Some Azalia implementations already do it, but most do not. Change-Id: I43ce72a01c07eff62d645db28c09584b386532ff Signed-off-by: Angel Pons <th3fanbus@gmail.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/46727 Reviewed-by: Michael Niewöhner <foss@mniewoehner.de> Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src/southbridge/intel/i82801ix/azalia.c')
-rw-r--r--src/southbridge/intel/i82801ix/azalia.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/southbridge/intel/i82801ix/azalia.c b/src/southbridge/intel/i82801ix/azalia.c
index 1d1405ea46..0e0ccd6b1a 100644
--- a/src/southbridge/intel/i82801ix/azalia.c
+++ b/src/southbridge/intel/i82801ix/azalia.c
@@ -43,11 +43,11 @@ static int codec_detect(u8 *base)
u32 reg32;
/* Set Bit 0 to 0 to enter reset state (BAR + 0x8)[0] */
- if (set_bits(base + HDA_GCTL_REG, 1, 0) == -1)
+ if (set_bits(base + HDA_GCTL_REG, 1, 0) < 0)
goto no_codec;
/* Set Bit 0 to 1 to exit reset state (BAR + 0x8)[0] */
- if (set_bits(base + HDA_GCTL_REG, 1, HDA_GCTL_CRST) == -1)
+ if (set_bits(base + HDA_GCTL_REG, 1, HDA_GCTL_CRST) < 0)
goto no_codec;
/* Read in Codec location (BAR + 0xe)[2..0] */
@@ -140,7 +140,7 @@ static void codec_init(struct device *dev, u8 *base, int addr)
printk(BIOS_DEBUG, "Azalia: Initializing codec #%d\n", addr);
/* 1 */
- if (wait_for_ready(base) == -1) {
+ if (wait_for_ready(base) < 0) {
printk(BIOS_DEBUG, " codec not ready.\n");
return;
}
@@ -148,7 +148,7 @@ static void codec_init(struct device *dev, u8 *base, int addr)
reg32 = (addr << 28) | 0x000f0000;
write32(base + HDA_IC_REG, reg32);
- if (wait_for_valid(base) == -1) {
+ if (wait_for_valid(base) < 0) {
printk(BIOS_DEBUG, " codec not valid.\n");
return;
}
@@ -166,12 +166,12 @@ static void codec_init(struct device *dev, u8 *base, int addr)
/* 3 */
for (i = 0; i < verb_size; i++) {
- if (wait_for_ready(base) == -1)
+ if (wait_for_ready(base) < 0)
return;
write32(base + HDA_IC_REG, verb[i]);
- if (wait_for_valid(base) == -1)
+ if (wait_for_valid(base) < 0)
return;
}
printk(BIOS_DEBUG, "Azalia: verb loaded.\n");
@@ -187,12 +187,12 @@ static void codecs_init(struct device *dev, u8 *base, u32 codec_mask)
}
for (i = 0; i < pc_beep_verbs_size; i++) {
- if (wait_for_ready(base) == -1)
+ if (wait_for_ready(base) < 0)
return;
write32(base + HDA_IC_REG, pc_beep_verbs[i]);
- if (wait_for_valid(base) == -1)
+ if (wait_for_valid(base) < 0)
return;
}
}