Skip to contentSkip to conversation

soundwire: qcom: use signed variable for error return

PATCH Applied Vinod Koul 4 participants 4 messages Mar 31, 2021 – May 26, 2021

Subsystems (3)
lore
Share & tools
lore

Vinod Koul

author maintainer
#0 lore raw

PATCH v2 1/1 soundwire: qcom: use signed variable for error return

We get warning of using a unsigned variable being compared to less than zero. The comparison is correct as it checks for errors from previous call to qcom_swrm_get_alert_slave_dev_num(), so we should use a signed variable here.

While at it, drop the superfluous initialization as well

drivers/soundwire/qcom.c: qcom_swrm_irq_handler() warn: impossible condition '(devnum < 0) => (0-255 < 0)'

---
 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.26.3
Reviewed-by on v2 1/1
#1 lore raw
Quoted 5 lines · Vinod Koul

We get warning of using a unsigned variable being compared to less than zero. The comparison is correct as it checks for errors from previous call to qcom_swrm_get_alert_slave_dev_num(), so we should use a signed variable here.

Quoted 7 lines

While at it, drop the superfluous initialization as well

drivers/soundwire/qcom.c: qcom_swrm_irq_handler() warn: impossible condition '(devnum < 0) => (0-255 < 0)'

Quoted 18 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);
Reviewed-by on v2 1/1
#2 lore raw
In reply to Vinod Koul
Quoted 5 lines · Vinod Koul

We get warning of using a unsigned variable being compared to less than zero. The comparison is correct as it checks for errors from previous call to qcom_swrm_get_alert_slave_dev_num(), so we should use a signed variable here.

Quoted 7 lines

While at it, drop the superfluous initialization as well

drivers/soundwire/qcom.c: qcom_swrm_irq_handler() warn: impossible condition '(devnum < 0) => (0-255 < 0)'

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.26.3
#3 lore raw
In reply to Vinod Koul
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 8 lines · On Wed, 31 Mar 2021 21:25:20 +0530 you wrote:

We get warning of using a unsigned variable being compared to less than zero. The comparison is correct as it checks for errors from previous call to qcom_swrm_get_alert_slave_dev_num(), so we should use a signed variable here.

While at it, drop the superfluous initialization as well

[...]

Here is the summary with links:
- [V2] soundwire: qcom: use signed variable for error return

    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