MLK-12175: dma: imx-sdma: fix issues repoted by Coverity
authorRobin Gong <yibin.gong@nxp.com>
Mon, 11 Jan 2016 05:41:23 +0000 (13:41 +0800)
committerNitin Garg <nitin.garg@nxp.com>
Mon, 19 Mar 2018 19:49:42 +0000 (14:49 -0500)
Fix two code issues, but not function break or potential bug:
  --Unsigned compared against 0 (NO_EFFECT)
  --Wrong size argument (SIZEOF_MISMATCH)

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
drivers/dma/imx-sdma.c

index d036401..581df66 100644 (file)
@@ -7,7 +7,7 @@
  *
  * Based on code from Freescale:
  *
- * Copyright 2004-2015 Freescale Semiconductor, Inc. All Rights Reserved.
+ * Copyright 2004-2016 Freescale Semiconductor, Inc. All Rights Reserved.
  *
  * The code contained herein is licensed under the GNU General Public
  * License. You may obtain a copy of the GNU General Public License
@@ -1094,11 +1094,9 @@ static int sdma_config_channel(struct dma_chan *chan)
        sdmac->shp_addr = 0;
        sdmac->per_addr = 0;
 
-       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)
@@ -1289,8 +1287,7 @@ static void sdma_free_chan_resources(struct dma_chan *chan)
 
        sdma_disable_channel(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);