Skip to contentSkip to conversation

dmaengine: zynqmp_dma: Fix static checker warning

PATCH Superseded Kedareswara rao Appana 2 participants 3 messages Jul 13, 2016

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dmaengine: zynqmp_dma: Fix static checker warning

This patch fixes the below static checker warning drivers/dma/xilinx/zynqmp_dma.c:973 zynqmp_dma_chan_probe()

	warn: was && intended here instead of ||?
---
 drivers/dma/xilinx/zynqmp_dma.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)
drivers/dma/xilinx/zynqmp_dma.c +7 -2
index f777a5b..2248704 100644
@@ -970,8 +970,13 @@ static int zynqmp_dma_chan_probe(struct zynqmp_dma_device *zdev,
 	chan->dst_burst_len = ZYNQMP_DMA_AWLEN_RST_VAL;
 	chan->src_burst_len = ZYNQMP_DMA_ARLEN_RST_VAL;
 	err = of_property_read_u32(node, "xlnx,bus-width", &chan->bus_width);
-	if ((err < 0) && ((chan->bus_width != ZYNQMP_DMA_BUS_WIDTH_64) ||
-			  (chan->bus_width != ZYNQMP_DMA_BUS_WIDTH_128))) {
+	if (err < 0) {
+		dev_err(&pdev->dev, "missing xlnx,bus-width property\n");
+		return err;
+	}
+
+	if ((chan->bus_width != ZYNQMP_DMA_BUS_WIDTH_64) ||
+	    (chan->bus_width != ZYNQMP_DMA_BUS_WIDTH_128)) {
 		dev_err(zdev->dev, "invalid bus-width value");
 		return err;
 	}
Signature · 1 line
1.7.1
#1 lore raw
Quoted 6 lines · Kedareswara rao Appana
drivers/dma/xilinx/zynqmp_dma.c +0 -0
index f777a5b..2248704 100644
@@ -970,8 +970,13 @@ static int zynqmp_dma_chan_probe(struct zynqmp_dma_device *zdev,
 	chan->dst_burst_len = ZYNQMP_DMA_AWLEN_RST_VAL;

drivers/dma/xilinx/zynqmp_dma.c static int zynqmp_dma_chan_probe(struct zynqmp_dma_device *zdev, · line 978

Quoted 10 lines
drivers/dma/xilinx/zynqmp_dma.c +6 -2
 	chan->src_burst_len = ZYNQMP_DMA_ARLEN_RST_VAL;
 	err = of_property_read_u32(node, "xlnx,bus-width", &chan->bus_width);
-	if ((err < 0) && ((chan->bus_width != ZYNQMP_DMA_BUS_WIDTH_64) ||
-			  (chan->bus_width != ZYNQMP_DMA_BUS_WIDTH_128))) {
+	if (err < 0) {
+		dev_err(&pdev->dev, "missing xlnx,bus-width property\n");
+		return err;
+	}
+
+	if ((chan->bus_width != ZYNQMP_DMA_BUS_WIDTH_64) ||

This has to be an && because it can never be both widths. You didn't test this patch. Also too many parenthesis (you're thinking of LISP).

drivers/dma/xilinx/zynqmp_dma.c static int zynqmp_dma_chan_probe(struct zynqmp_dma_device *zdev, · line 981

Quoted 3 lines
drivers/dma/xilinx/zynqmp_dma.c +1 -0
+	    (chan->bus_width != ZYNQMP_DMA_BUS_WIDTH_128)) {
 		dev_err(zdev->dev, "invalid bus-width value");
 		return err;

This has to be a negative error code.

regards,
dan carpenter

#2 lore raw

Hi Dan,

Thanks for the review...

Quoted 14 lines · Kedareswara rao Appana

drivers/dma/xilinx/zynqmp_dma.c static int zynqmp_dma_chan_probe(struct

Quoted 5 lines
(quoted diff) +0 -0

b/drivers/dma/xilinx/zynqmp_dma.c index f777a5b..2248704 100644

drivers/dma/xilinx/zynqmp_dma.c +0 -0
@@ -970,8 +970,13 @@ static int zynqmp_dma_chan_probe(struct

zynqmp_dma_device *zdev,

drivers/dma/xilinx/zynqmp_dma.c static int zynqmp_dma_chan_probe(struct zynqmp_dma_device *zdev,

Quoted 6 lines
drivers/dma/xilinx/zynqmp_dma.c +0 -2
 	chan->dst_burst_len = ZYNQMP_DMA_AWLEN_RST_VAL;
 	chan->src_burst_len = ZYNQMP_DMA_ARLEN_RST_VAL;
 	err = of_property_read_u32(node, "xlnx,bus-width", &chan-
 bus_width);
-	if ((err < 0) && ((chan->bus_width != ZYNQMP_DMA_BUS_WIDTH_64) ||
-			  (chan->bus_width !=

ZYNQMP_DMA_BUS_WIDTH_128))) {

Quoted 9 lines

drivers/dma/xilinx/zynqmp_dma.c static int zynqmp_dma_chan_probe(struct zynqmp_dma_device *zdev, · line 978

Quoted 6 lines
drivers/dma/xilinx/zynqmp_dma.c +6 -0
+	if (err < 0) {
+		dev_err(&pdev->dev, "missing xlnx,bus-width property\n");
+		return err;
+	}
+
+	if ((chan->bus_width != ZYNQMP_DMA_BUS_WIDTH_64) ||

This has to be an && because it can never be both widths. You didn't test this patch. Also too many parenthesis (you're thinking of LISP).

Will fix in the next version...

Quoted 6 lines

drivers/dma/xilinx/zynqmp_dma.c static int zynqmp_dma_chan_probe(struct zynqmp_dma_device *zdev, · line 981

Quoted 4 lines
drivers/dma/xilinx/zynqmp_dma.c +1 -0
+	    (chan->bus_width != ZYNQMP_DMA_BUS_WIDTH_128)) {
 		dev_err(zdev->dev, "invalid bus-width value");
 		return err;

This has to be a negative error code.

Will fix in the next version...

Regards,
Kedar.