All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] dmaengine: imx-sdma: Fix: Remove 'always true' comparison
@ 2020-06-21 15:57 Fabio Estevam
  2020-06-22 15:29 ` Schrempf Frieder
  2020-06-24  5:46   ` Vinod Koul
  0 siblings, 2 replies; 4+ messages in thread
From: Fabio Estevam @ 2020-06-21 15:57 UTC (permalink / raw
  To: vkoul
  Cc: frieder.schrempf, dmaengine, linux-imx, linux-arm-kernel,
	Fabio Estevam

event_id0 is defined as 'unsigned int', so it is always greater or
equal to zero.

Remove the unneeded comparisons to fix the following W=1 build
warning:

drivers/dma/imx-sdma.c: In function 'sdma_free_chan_resources':
drivers/dma/imx-sdma.c:1334:23: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
1334 |  if (sdmac->event_id0 >= 0)
|                       ^~
drivers/dma/imx-sdma.c: In function 'sdma_config':
drivers/dma/imx-sdma.c:1635:23: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
1635 |  if (sdmac->event_id0 >= 0) {
|               

Fixes: 25962e1a7f1d ("dmaengine: imx-sdma: Fix the event id check to include RX event for UART6")
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Fabio Estevam <festevam@gmail.com>
---
 drivers/dma/imx-sdma.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c
index 91774039ae5d..270992c4fe47 100644
--- a/drivers/dma/imx-sdma.c
+++ b/drivers/dma/imx-sdma.c
@@ -1331,8 +1331,7 @@ static void sdma_free_chan_resources(struct dma_chan *chan)
 
 	sdma_channel_synchronize(chan);
 
-	if (sdmac->event_id0 >= 0)
-		sdma_event_disable(sdmac, sdmac->event_id0);
+	sdma_event_disable(sdmac, sdmac->event_id0);
 	if (sdmac->event_id1)
 		sdma_event_disable(sdmac, sdmac->event_id1);
 
@@ -1632,11 +1631,9 @@ static int sdma_config(struct dma_chan *chan,
 	memcpy(&sdmac->slave_config, dmaengine_cfg, sizeof(*dmaengine_cfg));
 
 	/* Set ENBLn earlier to make sure dma request triggered after that */
-	if (sdmac->event_id0 >= 0) {
-		if (sdmac->event_id0 >= sdmac->sdma->drvdata->num_events)
-			return -EINVAL;
-		sdma_event_enable(sdmac, sdmac->event_id0);
-	}
+	if (sdmac->event_id0 >= sdmac->sdma->drvdata->num_events)
+		return -EINVAL;
+	sdma_event_enable(sdmac, sdmac->event_id0);
 
 	if (sdmac->event_id1) {
 		if (sdmac->event_id1 >= sdmac->sdma->drvdata->num_events)
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] dmaengine: imx-sdma: Fix: Remove 'always true' comparison
  2020-06-21 15:57 [PATCH] dmaengine: imx-sdma: Fix: Remove 'always true' comparison Fabio Estevam
@ 2020-06-22 15:29 ` Schrempf Frieder
  2020-06-24  5:46   ` Vinod Koul
  1 sibling, 0 replies; 4+ messages in thread
From: Schrempf Frieder @ 2020-06-22 15:29 UTC (permalink / raw
  To: Fabio Estevam, vkoul@kernel.org
  Cc: dmaengine@vger.kernel.org, linux-imx@nxp.com,
	linux-arm-kernel@lists.infradead.org

On 21.06.20 17:57, Fabio Estevam wrote:
> event_id0 is defined as 'unsigned int', so it is always greater or
> equal to zero.
> 
> Remove the unneeded comparisons to fix the following W=1 build
> warning:
> 
> drivers/dma/imx-sdma.c: In function 'sdma_free_chan_resources':
> drivers/dma/imx-sdma.c:1334:23: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
> 1334 |  if (sdmac->event_id0 >= 0)
> |                       ^~
> drivers/dma/imx-sdma.c: In function 'sdma_config':
> drivers/dma/imx-sdma.c:1635:23: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
> 1635 |  if (sdmac->event_id0 >= 0) {
> |
> 
> Fixes: 25962e1a7f1d ("dmaengine: imx-sdma: Fix the event id check to include RX event for UART6")
> Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: Fabio Estevam <festevam@gmail.com>

Thanks!

Reviewed-by: Frieder Schrempf <frieder.schrempf@kontron.de>

> ---
>   drivers/dma/imx-sdma.c | 11 ++++-------
>   1 file changed, 4 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c
> index 91774039ae5d..270992c4fe47 100644
> --- a/drivers/dma/imx-sdma.c
> +++ b/drivers/dma/imx-sdma.c
> @@ -1331,8 +1331,7 @@ static void sdma_free_chan_resources(struct dma_chan *chan)
>   
>   	sdma_channel_synchronize(chan);
>   
> -	if (sdmac->event_id0 >= 0)
> -		sdma_event_disable(sdmac, sdmac->event_id0);
> +	sdma_event_disable(sdmac, sdmac->event_id0);
>   	if (sdmac->event_id1)
>   		sdma_event_disable(sdmac, sdmac->event_id1);
>   
> @@ -1632,11 +1631,9 @@ static int sdma_config(struct dma_chan *chan,
>   	memcpy(&sdmac->slave_config, dmaengine_cfg, sizeof(*dmaengine_cfg));
>   
>   	/* Set ENBLn earlier to make sure dma request triggered after that */
> -	if (sdmac->event_id0 >= 0) {
> -		if (sdmac->event_id0 >= sdmac->sdma->drvdata->num_events)
> -			return -EINVAL;
> -		sdma_event_enable(sdmac, sdmac->event_id0);
> -	}
> +	if (sdmac->event_id0 >= sdmac->sdma->drvdata->num_events)
> +		return -EINVAL;
> +	sdma_event_enable(sdmac, sdmac->event_id0);
>   
>   	if (sdmac->event_id1) {
>   		if (sdmac->event_id1 >= sdmac->sdma->drvdata->num_events)
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] dmaengine: imx-sdma: Fix: Remove 'always true' comparison
  2020-06-21 15:57 [PATCH] dmaengine: imx-sdma: Fix: Remove 'always true' comparison Fabio Estevam
@ 2020-06-24  5:46   ` Vinod Koul
  2020-06-24  5:46   ` Vinod Koul
  1 sibling, 0 replies; 4+ messages in thread
From: Vinod Koul @ 2020-06-24  5:46 UTC (permalink / raw
  To: Fabio Estevam; +Cc: dmaengine, linux-imx, frieder.schrempf, linux-arm-kernel

On 21-06-20, 12:57, Fabio Estevam wrote:
> event_id0 is defined as 'unsigned int', so it is always greater or
> equal to zero.
> 
> Remove the unneeded comparisons to fix the following W=1 build
> warning:
> 
> drivers/dma/imx-sdma.c: In function 'sdma_free_chan_resources':
> drivers/dma/imx-sdma.c:1334:23: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
> 1334 |  if (sdmac->event_id0 >= 0)
> |                       ^~
> drivers/dma/imx-sdma.c: In function 'sdma_config':
> drivers/dma/imx-sdma.c:1635:23: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
> 1635 |  if (sdmac->event_id0 >= 0) {
> |               

Applied, thanks

-- 
~Vinod

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] dmaengine: imx-sdma: Fix: Remove 'always true' comparison
@ 2020-06-24  5:46   ` Vinod Koul
  0 siblings, 0 replies; 4+ messages in thread
From: Vinod Koul @ 2020-06-24  5:46 UTC (permalink / raw
  To: Fabio Estevam; +Cc: frieder.schrempf, dmaengine, linux-imx, linux-arm-kernel

On 21-06-20, 12:57, Fabio Estevam wrote:
> event_id0 is defined as 'unsigned int', so it is always greater or
> equal to zero.
> 
> Remove the unneeded comparisons to fix the following W=1 build
> warning:
> 
> drivers/dma/imx-sdma.c: In function 'sdma_free_chan_resources':
> drivers/dma/imx-sdma.c:1334:23: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
> 1334 |  if (sdmac->event_id0 >= 0)
> |                       ^~
> drivers/dma/imx-sdma.c: In function 'sdma_config':
> drivers/dma/imx-sdma.c:1635:23: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
> 1635 |  if (sdmac->event_id0 >= 0) {
> |               

Applied, thanks

-- 
~Vinod

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-06-24  5:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-06-21 15:57 [PATCH] dmaengine: imx-sdma: Fix: Remove 'always true' comparison Fabio Estevam
2020-06-22 15:29 ` Schrempf Frieder
2020-06-24  5:46 ` Vinod Koul
2020-06-24  5:46   ` Vinod Koul

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.