Skip to contentSkip to conversation

ia64: pci: Fix a condition in pcibr_dmamap_ate32()

PATCH In review Dan Carpenter 2 participants 3 messages Dec 8, 2016 – Dec 17, 2018 Kernel janitors

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ia64: pci: Fix a condition in pcibr_dmamap_ate32()

Smatch complains that probably this condition isn't correct because it first does a comparison and then a mask. Judging from the surrounding code probably the parenthesis are in the wrong place.

The original code is equivalent to:

if (dma_flags = SN_DMA_ADDR_PHYS)

And it's probably going to be true less often than my corrected version.

Fixes 83821d3f558d ("[PATCH] PCI: altix: msi support")
arch/ia64/sn/pci/pcibr/pcibr_dma.c +1 -1
index 1e863b277ac9..71c9bf308adf 100644
@@ -82,7 +82,7 @@
 	if (IS_PCIX(pcibus_info))
 		ate_flags &= ~(PCI32_ATE_PREF);
 
-	if (SN_DMA_ADDRTYPE(dma_flags = SN_DMA_ADDR_PHYS))
+	if (SN_DMA_ADDRTYPE(dma_flags) = SN_DMA_ADDR_PHYS)
 		xio_addr = IS_PIC_SOFT(pcibus_info) ? PHYS_TO_DMA(paddr) :
 	    					      PHYS_TO_TIODMA(paddr);
 	else
#1 lore raw

This patch is still required. Would you like me to resend it?

regards,
dan carpenter

Quoted 26 lines · Dan Carpenter

Smatch complains that probably this condition isn't correct because it first does a comparison and then a mask. Judging from the surrounding code probably the parenthesis are in the wrong place.

The original code is equivalent to:

if (dma_flags = SN_DMA_ADDR_PHYS)

And it's probably going to be true less often than my corrected version.

Fixes 83821d3f558d ("[PATCH] PCI: altix: msi support")
arch/ia64/sn/pci/pcibr/pcibr_dma.c +1 -1
index 1e863b277ac9..71c9bf308adf 100644
@@ -82,7 +82,7 @@
 	if (IS_PCIX(pcibus_info))
 		ate_flags &= ~(PCI32_ATE_PREF);
 
-	if (SN_DMA_ADDRTYPE(dma_flags = SN_DMA_ADDR_PHYS))
+	if (SN_DMA_ADDRTYPE(dma_flags) = SN_DMA_ADDR_PHYS)
 		xio_addr = IS_PIC_SOFT(pcibus_info) ? PHYS_TO_DMA(paddr) :
 	    					      PHYS_TO_TIODMA(paddr);
 	else