diff options
author | Colin Ian King <colin.king@canonical.com> | 2021-06-23 06:38:48 +0300 |
---|---|---|
committer | Joel Stanley <joel@jms.id.au> | 2021-06-24 12:23:05 +0300 |
commit | 794fe710153393b95076411b81f70770ce2bc7c6 (patch) | |
tree | bf3b3d73fc8051494f306a68ad546fcf1bfdc445 | |
parent | d390b2602861139405e03a474a217975591c33e6 (diff) | |
download | linux-794fe710153393b95076411b81f70770ce2bc7c6.tar.xz |
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.
OpenBMC-Staging-Count: 1
Addresses-Coverity: ("Unsigned compared against 0")
Fixes: 9d2df9a0ad80 ("ipmi: kcs_bmc_aspeed: Implement KCS SerIRQ configuration")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Message-Id: <20210616162913.15259-1-colin.king@canonical.com>
Signed-off-by: Corey Minyard <cminyard@mvista.com>
Link: https://lore.kernel.org/r/20210623033854.587464-2-andrew@aj.id.au
Signed-off-by: Joel Stanley <joel@jms.id.au>
-rw-r--r-- | drivers/char/ipmi/kcs_bmc_aspeed.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/char/ipmi/kcs_bmc_aspeed.c b/drivers/char/ipmi/kcs_bmc_aspeed.c index 9753ed0a5be6..b555286016b1 100644 --- a/drivers/char/ipmi/kcs_bmc_aspeed.c +++ b/drivers/char/ipmi/kcs_bmc_aspeed.c @@ -301,13 +301,15 @@ static inline int aspeed_kcs_map_serirq_type(u32 dt_type) static int aspeed_kcs_config_upstream_irq(struct aspeed_kcs_bmc *priv, u32 id, u32 dt_type) { unsigned int mask, val, hw_type; + int ret; if (id > 15) return -EINVAL; - hw_type = aspeed_kcs_map_serirq_type(dt_type); - if (hw_type < 0) - return hw_type; + ret = aspeed_kcs_map_serirq_type(dt_type); + if (ret < 0) + return ret; + hw_type = ret; priv->upstream_irq.mode = aspeed_kcs_irq_serirq; priv->upstream_irq.id = id; |