net: ipa: pass correct dma_handle to dma_free_coherent()
Subsystems (4)
PATCH 1/1 net: ipa: pass correct dma_handle to dma_free_coherent()
The "ring->addr = addr;" assignment is done a few lines later so we can't use "ring->addr" yet. The correct dma_handle is "addr".
---
Smatch also complians about:
drivers/net/ipa/gsi.c:1739 gsi_channel_setup()
warn: missing error code 'ret'
It probably should return -EINVAL, but I'm not positive.
drivers/net/ipa/gsi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ipa/gsi.c +1 -1
@@ -1373,7 +1373,7 @@ static int gsi_ring_alloc(struct gsi *gsi, struct gsi_ring *ring, u32 count)/* Hardware requires a 2^n ring size, with alignment equal to size */ ring->virt =dma_alloc_coherent (dev, size, &addr,GFP_KERNEL );if (ring->virt && addr % size) { -dma_free_coherent (dev, size, ring->virt, ring->addr); +dma_free_coherent (dev, size, ring->virt, addr);dev_err (dev,"unable to alloc 0x%zx-aligned ring buffer\n" , size);return -EINVAL ;/* Not a good error value, but distinct */
Signature · 1 line
2.29.2
Quoted 5 lines · Dan Carpenter
The "
ring->addr= addr;" assignment is done a few lines later so we can't use "ring->addr" yet. The correctdma_handleis "addr".Fixes 650d1603825d ("soc: qcom: ipa: the generic software interface")Signed-off-by Dan Carpenter <[email protected]>
Yikes. Thank you for the fix.
Quoted 25 lines
---
Smatch also complians about:
drivers/net/ipa/gsi.c:1739gsi_channel_setup()
warn: missing error code 'ret'It probably should return
-EINVAL, but I'm not positive.drivers/net/ipa/gsi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/net/ipa/gsi.c +1
-1@@ -1373,7 +1373,7 @@ static int gsi_ring_alloc(struct gsi *gsi, struct gsi_ring *ring, u32 count)/* Hardware requires a 2^n ring size, with alignment equal to size */ ring->virt =dma_alloc_coherent (dev, size, &addr,GFP_KERNEL );if (ring->virt && addr % size) { -dma_free_coherent (dev, size, ring->virt, ring->addr); +dma_free_coherent (dev, size, ring->virt, addr);dev_err (dev,"unable to alloc 0x%zx-aligned ring buffer\n" , size);return -EINVAL ;/* Not a good error value, but distinct */
Quoted 10 lines · On Tue, 2 Feb 2021 05:48:11 -0600 Alex Elder wrote:
Quoted 5 lines · Dan Carpenter
The "
ring->addr= addr;" assignment is done a few lines later so we can't use "ring->addr" yet. The correctdma_handleis "addr".Fixes 650d1603825d ("soc: qcom: ipa: the generic software interface")Signed-off-by Dan Carpenter <[email protected]>Yikes. Thank you for the fix.
Reviewed-by Alex Elder <[email protected]>
Applied, thanks!