Skip to content

Commit 5b32dd2

Browse files
Colin Ian Kingcminyard
authored andcommitted
ipmi: kcs_bmc_aspeed: Fix less than zero comparison of a unsigned int
The comparisons of the unsigned int hw_type to less than zero always false because it is unsigned. Fix this by using an int for the assignment and less than zero check. Addresses-Coverity: ("Unsigned compared against 0") Fixes: 9d2df9a ("ipmi: kcs_bmc_aspeed: Implement KCS SerIRQ configuration") Signed-off-by: Colin Ian King <[email protected]> Message-Id: <[email protected]> Signed-off-by: Corey Minyard <[email protected]>
1 parent d0ec795 commit 5b32dd2

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

drivers/char/ipmi/kcs_bmc_aspeed.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -301,13 +301,15 @@ static inline int aspeed_kcs_map_serirq_type(u32 dt_type)
301301
static int aspeed_kcs_config_upstream_irq(struct aspeed_kcs_bmc *priv, u32 id, u32 dt_type)
302302
{
303303
unsigned int mask, val, hw_type;
304+
int ret;
304305

305306
if (id > 15)
306307
return -EINVAL;
307308

308-
hw_type = aspeed_kcs_map_serirq_type(dt_type);
309-
if (hw_type < 0)
310-
return hw_type;
309+
ret = aspeed_kcs_map_serirq_type(dt_type);
310+
if (ret < 0)
311+
return ret;
312+
hw_type = ret;
311313

312314
priv->upstream_irq.mode = aspeed_kcs_irq_serirq;
313315
priv->upstream_irq.id = id;

0 commit comments

Comments
 (0)