Skip to content

Commit 78509c4

Browse files
hodgesdsgregkh
authored andcommitted
PCI: epf-mhi: Return 0, not remaining timeout, when eDMA ops complete
[ Upstream commit 36bfc36 ] pci_epf_mhi_edma_read() and pci_epf_mhi_edma_write() start DMA operations and wait for completion with a timeout. On successful completion, they previously returned the remaining timeout, which callers may treat as an error. In particular, mhi_ep_ring_add_element(), which calls pci_epf_mhi_edma_write() via mhi_cntrl->write_sync(), interprets any non-zero return value as failure. Return 0 on success instead of the remaining timeout to prevent mhi_ep_ring_add_element() from treating successful completion as an error. Fixes: 7b99aaa ("PCI: epf-mhi: Add eDMA support") Signed-off-by: Daniel Hodges <git@danielhodges.dev> [mani: changed commit log as per https://lore.kernel.org/linux-pci/20260227191510.GA3904799@bhelgaas] Signed-off-by: Manivannan Sadhasivam <mani@kernel.org> Reviewed-by: Krishna Chaitanya Chundru <krishna.chundru@oss.qualcomm.com> Cc: stable@vger.kernel.org Link: https://patch.msgid.link/20260206200529.10784-1-git@danielhodges.dev Signed-off-by: Sasha Levin <sashal@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 801000a commit 78509c4

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

drivers/pci/endpoint/functions/pci-epf-mhi.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,8 @@ static int pci_epf_mhi_edma_read(struct mhi_ep_cntrl *mhi_cntrl,
331331
dev_err(dev, "DMA transfer timeout\n");
332332
dmaengine_terminate_sync(chan);
333333
ret = -ETIMEDOUT;
334+
} else {
335+
ret = 0;
334336
}
335337

336338
err_unmap:
@@ -402,6 +404,8 @@ static int pci_epf_mhi_edma_write(struct mhi_ep_cntrl *mhi_cntrl,
402404
dev_err(dev, "DMA transfer timeout\n");
403405
dmaengine_terminate_sync(chan);
404406
ret = -ETIMEDOUT;
407+
} else {
408+
ret = 0;
405409
}
406410

407411
err_unmap:

0 commit comments

Comments
 (0)