Skip to contentSkip to conversation

drivers/dma: Fix unsigned compared against 0

PATCH Applied Advait Dhamorikar 2 participants 3 messages Oct 5, 2024 – Oct 14, 2024 dmaengine

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drivers/dma: Fix unsigned compared against 0

An unsigned value can never be negative,
so this test will always evaluate the same way.
In ep93xx_dma_alloc_chan_resources: An unsigned dma_cfg.port's value is checked against EP93XX_DMA_I2S1 which is 0.

---
 drivers/dma/ep93xx_dma.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/dma/ep93xx_dma.c +1 -2
index 995427afe077..6d7f6bd12d76 100644
@@ -929,8 +929,7 @@ static int ep93xx_dma_alloc_chan_resources(struct dma_chan *chan)
 
 	/* Sanity check the channel parameters */
 	if (!edmac->edma->m2m) {
-		if (edmac->dma_cfg.port < EP93XX_DMA_I2S1 ||
-		    edmac->dma_cfg.port > EP93XX_DMA_IRDA)
+		if (edmac->dma_cfg.port > EP93XX_DMA_IRDA)
 			return -EINVAL;
 		if (edmac->dma_cfg.dir != ep93xx_dma_chan_direction(chan))
 			return -EINVAL;
Signature · 1 line
2.34.1
maintainer
#1 lore raw
Quoted 4 lines · Advait Dhamorikar

An unsigned value can never be negative,
so this test will always evaluate the same way.
In ep93xx_dma_alloc_chan_resources: An unsigned dma_cfg.port's value is checked against EP93XX_DMA_I2S1 which is 0.

Please use subject line dmaengine: ... git log will tell you the tags to use

I am fixing it up and applying

Quoted 22 lines
---
 drivers/dma/ep93xx_dma.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/dma/ep93xx_dma.c +1 -2
index 995427afe077..6d7f6bd12d76 100644
@@ -929,8 +929,7 @@ static int ep93xx_dma_alloc_chan_resources(struct dma_chan *chan)
 
 	/* Sanity check the channel parameters */
 	if (!edmac->edma->m2m) {
-		if (edmac->dma_cfg.port < EP93XX_DMA_I2S1 ||
-		    edmac->dma_cfg.port > EP93XX_DMA_IRDA)
+		if (edmac->dma_cfg.port > EP93XX_DMA_IRDA)
 			return -EINVAL;
 		if (edmac->dma_cfg.dir != ep93xx_dma_chan_direction(chan))
 			return -EINVAL;
Signature · 1 line
2.34.1
Signature · 1 line
~Vinod
maintainer Applied
#2 lore raw
In reply to Advait Dhamorikar
Quoted 6 lines · Advait Dhamorikar

An unsigned value can never be negative,
so this test will always evaluate the same way.
In ep93xx_dma_alloc_chan_resources: An unsigned dma_cfg.port's value is checked against EP93XX_DMA_I2S1 which is 0.

Applied, thanks!

[1/1] drivers/dma: Fix unsigned compared against 0

      commit: 0aa4523cdb9683e35af91ebdfae8d2fb4e6c3b8b

Best regards,

Signature · 1 line
~Vinod