[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <7c44e9da-e7d6-4288-b000-939ffcdf7b39@oss.qualcomm.com>
Date: Mon, 9 Feb 2026 10:36:21 +0530
From: Krishna Chaitanya Chundru <krishna.chundru@....qualcomm.com>
To: Daniel Hodges <git@...ielhodges.dev>, mani@...nel.org,
kwilczynski@...nel.org
Cc: kishon@...nel.org, bhelgaas@...gle.com, mhi@...ts.linux.dev,
linux-arm-msm@...r.kernel.org, linux-pci@...r.kernel.org,
linux-kernel@...r.kernel.org, stable@...r.kernel.org
Subject: Re: [PATCH] PCI: epf-mhi: return 0 on success instead of positive
jiffies
On 2/7/2026 1:35 AM, Daniel Hodges wrote:
> wait_for_completion_timeout() returns the number of jiffies remaining
> on success (positive value) or 0 on timeout. The pci_epf_mhi_edma_read()
> and pci_epf_mhi_edma_write() functions use the return value directly as
> their own return value, only converting timeout (0) to -ETIMEDOUT.
>
> On success, they return the positive jiffies value. The callers in
> drivers/bus/mhi/ep/ring.c check for errors with "if (ret < 0)" for
> read_sync and "if (ret)" for write_sync. This causes write_sync success
> cases to be incorrectly treated as errors since the positive jiffies
> value is non-zero.
>
> Fix by setting ret to 0 when wait_for_completion_timeout() succeeds.
>
> Fixes: 7b99aaaddabb ("PCI: epf-mhi: Add eDMA support")
> Cc: stable@...r.kernel.org
> Signed-off-by: Daniel Hodges <git@...ielhodges.dev>
Reviewed-by: Krishna Chaitanya Chundru<krishna.chundru@....qualcomm.com>
- Krishna Chaitanya.
> ---
> drivers/pci/endpoint/functions/pci-epf-mhi.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/pci/endpoint/functions/pci-epf-mhi.c b/drivers/pci/endpoint/functions/pci-epf-mhi.c
> index 6643a88c7a0c..2f077d0b7957 100644
> --- a/drivers/pci/endpoint/functions/pci-epf-mhi.c
> +++ b/drivers/pci/endpoint/functions/pci-epf-mhi.c
> @@ -367,6 +367,8 @@ static int pci_epf_mhi_edma_read(struct mhi_ep_cntrl *mhi_cntrl,
> dev_err(dev, "DMA transfer timeout\n");
> dmaengine_terminate_sync(chan);
> ret = -ETIMEDOUT;
> + } else {
> + ret = 0;
> }
>
> err_unmap:
> @@ -438,6 +440,8 @@ static int pci_epf_mhi_edma_write(struct mhi_ep_cntrl *mhi_cntrl,
> dev_err(dev, "DMA transfer timeout\n");
> dmaengine_terminate_sync(chan);
> ret = -ETIMEDOUT;
> + } else {
> + ret = 0;
> }
>
> err_unmap:
Powered by blists - more mailing lists