linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] PCI: epf-mhi: Fix the DMA data direction of dma_unmap_single()
@ 2023-12-14  6:33 Manivannan Sadhasivam
  2023-12-14 19:35 ` Krzysztof Wilczyński
  0 siblings, 1 reply; 3+ messages in thread
From: Manivannan Sadhasivam @ 2023-12-14  6:33 UTC (permalink / raw)
  To: lpieralisi, kw, bhelgaas
  Cc: kishon, mhi, linux-arm-msm, linux-pci, linux-kernel,
	Manivannan Sadhasivam

In the error path of pci_epf_mhi_edma_write() function, the DMA data
direction passed (DMA_FROM_DEVICE) doesn't match the actual direction used
for the data transfer. Fix it by passing the correct one (DMA_TO_DEVICE).

Fixes: 7b99aaaddabb ("PCI: epf-mhi: Add eDMA support")
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
---

Bjorn, Krzysztof, I'd like to apply this patch to MHI tree on top of eDMA
async patches due to dependency:
https://lore.kernel.org/linux-pci/20231127124529.78203-1-manivannan.sadhasivam@linaro.org/

 drivers/pci/endpoint/functions/pci-epf-mhi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pci/endpoint/functions/pci-epf-mhi.c b/drivers/pci/endpoint/functions/pci-epf-mhi.c
index 472bc489b754..d3d6a1054036 100644
--- a/drivers/pci/endpoint/functions/pci-epf-mhi.c
+++ b/drivers/pci/endpoint/functions/pci-epf-mhi.c
@@ -424,7 +424,7 @@ static int pci_epf_mhi_edma_write(struct mhi_ep_cntrl *mhi_cntrl,
 	}
 
 err_unmap:
-	dma_unmap_single(dma_dev, src_addr, buf_info->size, DMA_FROM_DEVICE);
+	dma_unmap_single(dma_dev, src_addr, buf_info->size, DMA_TO_DEVICE);
 err_unlock:
 	mutex_unlock(&epf_mhi->lock);
 

base-commit: f5668f251e29292326e45a022f933c15740a8af2
-- 
2.25.1


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

* Re: [PATCH] PCI: epf-mhi: Fix the DMA data direction of dma_unmap_single()
  2023-12-14  6:33 [PATCH] PCI: epf-mhi: Fix the DMA data direction of dma_unmap_single() Manivannan Sadhasivam
@ 2023-12-14 19:35 ` Krzysztof Wilczyński
  2023-12-15 11:00   ` Manivannan Sadhasivam
  0 siblings, 1 reply; 3+ messages in thread
From: Krzysztof Wilczyński @ 2023-12-14 19:35 UTC (permalink / raw)
  To: Manivannan Sadhasivam
  Cc: lpieralisi, bhelgaas, kishon, mhi, linux-arm-msm, linux-pci,
	linux-kernel

Hello,

> In the error path of pci_epf_mhi_edma_write() function, the DMA data
> direction passed (DMA_FROM_DEVICE) doesn't match the actual direction used
> for the data transfer. Fix it by passing the correct one (DMA_TO_DEVICE).

Nice catch!

> Fixes: 7b99aaaddabb ("PCI: epf-mhi: Add eDMA support")
> Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
> ---
> 
> Bjorn, Krzysztof, I'd like to apply this patch to MHI tree on top of eDMA
> async patches due to dependency:
> https://lore.kernel.org/linux-pci/20231127124529.78203-1-manivannan.sadhasivam@linaro.org/

Sounds good to me!  We still have a little time, so let me know if you
change your mind about who should take this patch and the other series. :)

>  drivers/pci/endpoint/functions/pci-epf-mhi.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/pci/endpoint/functions/pci-epf-mhi.c b/drivers/pci/endpoint/functions/pci-epf-mhi.c
> index 472bc489b754..d3d6a1054036 100644
> --- a/drivers/pci/endpoint/functions/pci-epf-mhi.c
> +++ b/drivers/pci/endpoint/functions/pci-epf-mhi.c
> @@ -424,7 +424,7 @@ static int pci_epf_mhi_edma_write(struct mhi_ep_cntrl *mhi_cntrl,
>  	}
>  
>  err_unmap:
> -	dma_unmap_single(dma_dev, src_addr, buf_info->size, DMA_FROM_DEVICE);
> +	dma_unmap_single(dma_dev, src_addr, buf_info->size, DMA_TO_DEVICE);
>  err_unlock:
>  	mutex_unlock(&epf_mhi->lock);

Looks good!

Reviewed-by: Krzysztof Wilczyński <kw@linux.com>

	Krzysztof

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

* Re: [PATCH] PCI: epf-mhi: Fix the DMA data direction of dma_unmap_single()
  2023-12-14 19:35 ` Krzysztof Wilczyński
@ 2023-12-15 11:00   ` Manivannan Sadhasivam
  0 siblings, 0 replies; 3+ messages in thread
From: Manivannan Sadhasivam @ 2023-12-15 11:00 UTC (permalink / raw)
  To: Krzysztof Wilczyński
  Cc: lpieralisi, bhelgaas, kishon, mhi, linux-arm-msm, linux-pci,
	linux-kernel

On Fri, Dec 15, 2023 at 04:35:21AM +0900, Krzysztof Wilczyński wrote:
> Hello,
> 
> > In the error path of pci_epf_mhi_edma_write() function, the DMA data
> > direction passed (DMA_FROM_DEVICE) doesn't match the actual direction used
> > for the data transfer. Fix it by passing the correct one (DMA_TO_DEVICE).
> 
> Nice catch!
> 
> > Fixes: 7b99aaaddabb ("PCI: epf-mhi: Add eDMA support")
> > Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
> > ---
> > 
> > Bjorn, Krzysztof, I'd like to apply this patch to MHI tree on top of eDMA
> > async patches due to dependency:
> > https://lore.kernel.org/linux-pci/20231127124529.78203-1-manivannan.sadhasivam@linaro.org/
> 
> Sounds good to me!  We still have a little time, so let me know if you
> change your mind about who should take this patch and the other series. :)
> 

No change in plan :)

> >  drivers/pci/endpoint/functions/pci-epf-mhi.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/pci/endpoint/functions/pci-epf-mhi.c b/drivers/pci/endpoint/functions/pci-epf-mhi.c
> > index 472bc489b754..d3d6a1054036 100644
> > --- a/drivers/pci/endpoint/functions/pci-epf-mhi.c
> > +++ b/drivers/pci/endpoint/functions/pci-epf-mhi.c
> > @@ -424,7 +424,7 @@ static int pci_epf_mhi_edma_write(struct mhi_ep_cntrl *mhi_cntrl,
> >  	}
> >  
> >  err_unmap:
> > -	dma_unmap_single(dma_dev, src_addr, buf_info->size, DMA_FROM_DEVICE);
> > +	dma_unmap_single(dma_dev, src_addr, buf_info->size, DMA_TO_DEVICE);
> >  err_unlock:
> >  	mutex_unlock(&epf_mhi->lock);
> 
> Looks good!
> 
> Reviewed-by: Krzysztof Wilczyński <kw@linux.com>
> 

Thanks! Applied to mhi-next.

- Mani

> 	Krzysztof

-- 
மணிவண்ணன் சதாசிவம்

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

end of thread, other threads:[~2023-12-15 11:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-14  6:33 [PATCH] PCI: epf-mhi: Fix the DMA data direction of dma_unmap_single() Manivannan Sadhasivam
2023-12-14 19:35 ` Krzysztof Wilczyński
2023-12-15 11:00   ` Manivannan Sadhasivam

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).