Skip to contentSkip to conversation

soundwire: qcom: Fix a u8 comparison with less than zero

PATCH Applied Colin King 3 participants 3 messages Mar 31, 2021 – May 26, 2021

Subsystems (4)
lore
Share & tools
lore

Colin King

author
#0 lore raw

PATCH 1/1 soundwire: qcom: Fix a u8 comparison with less than zero

From: Colin Ian King <[email protected]>

Variable devnum is being checked for a less than zero error return however the comparison will always be false because devnum is an 8 bit unsigned integer. Fix this by making devnum an int. Also there is no need to iniitialize devnum with zero as this value is no read, so remove the redundant assignment.

Addresses-Coverity: ("Unsigned compared against 0")

Fixes c7d49c76d1d5 ("soundwire: qcom: add support to new interrupts")
---
 drivers/soundwire/qcom.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/soundwire/qcom.c +1 -1
index b08ecb9b418c..ec86c4e53fdb 100644
@@ -428,7 +428,7 @@ static irqreturn_t qcom_swrm_irq_handler(int irq, void *dev_id)
 	struct qcom_swrm_ctrl *swrm = dev_id;
 	u32 value, intr_sts, intr_sts_masked, slave_status;
 	u32 i;
-	u8 devnum = 0;
+	int devnum;
 	int ret = IRQ_HANDLED;
 
 	swrm->reg_read(swrm, SWRM_INTERRUPT_STATUS, &intr_sts);
Signature · 1 line
2.30.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 11 lines · Colin King

From: Colin Ian King <[email protected]>

Variable devnum is being checked for a less than zero error return however the comparison will always be false because devnum is an 8 bit unsigned integer. Fix this by making devnum an int. Also there is no need to iniitialize devnum with zero as this value is no read, so remove the redundant assignment.

Addresses-Coverity: ("Unsigned compared against 0")

Fixes c7d49c76d1d5 ("soundwire: qcom: add support to new interrupts")
Quoted 20 lines
---
 drivers/soundwire/qcom.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/soundwire/qcom.c +1 -1
index b08ecb9b418c..ec86c4e53fdb 100644
@@ -428,7 +428,7 @@ static irqreturn_t qcom_swrm_irq_handler(int irq, void *dev_id)
 	struct qcom_swrm_ctrl *swrm = dev_id;
 	u32 value, intr_sts, intr_sts_masked, slave_status;
 	u32 i;
-	u8 devnum = 0;
+	int devnum;
 	int ret = IRQ_HANDLED;
 
 	swrm->reg_read(swrm, SWRM_INTERRUPT_STATUS, &intr_sts);
Signature · 1 line
2.30.2
#2 lore raw
In reply to Colin King
This patch was applied to qcom/linux.git (refs/heads/for-next):

Hello:

This patch was applied to qcom/linux.git (refs/heads/for-next):

Quoted 9 lines · On Wed, 31 Mar 2021 15:09:44 +0100 you wrote:

From: Colin Ian King <[email protected]>

Variable devnum is being checked for a less than zero error return however the comparison will always be false because devnum is an 8 bit unsigned integer. Fix this by making devnum an int. Also there is no need to iniitialize devnum with zero as this value is no read, so remove the redundant assignment.

[...]

Here is the summary with links:
- [next] soundwire: qcom: Fix a u8 comparison with less than zero

    https://git.kernel.org/qcom/c/b26b48749b18

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html