[PATCH v10 19/29] dmaengine: dw-edma: Fix return value truncation in readq_ch()

From: Serge Semin
Date: Wed Jan 25 2023 - 10:19:00 EST


The denoted method returns the u64 value meanwhile the local variable
utilized for that is defined as u32. Thus even though the requested
address is accessed by the readq() method the retrieved data will be
truncated to dword. Fix that by changing the local variable type to u64
thus preventing the data truncation.

Note the method is currently unused. That's why the bug hasn't caused any
problem so far.

Fixes: 04e0a39fc10f ("dmaengine: dw-edma: Add writeq() and readq() for 64 bits architectures")
Signed-off-by: Serge Semin <Sergey.Semin@xxxxxxxxxxxxxxxxxxxx>

---

Changelog v10:
- This update was detached from the v9 patch:
Link: https://lore.kernel.org/linux-pci/20230113171409.30470-20-Sergey.Semin@xxxxxxxxxxxxxxxxxxxx
(@Bjorn)
---
drivers/dma/dw-edma/dw-edma-v0-core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/dma/dw-edma/dw-edma-v0-core.c b/drivers/dma/dw-edma/dw-edma-v0-core.c
index 66f296daac5a..13f40560571b 100644
--- a/drivers/dma/dw-edma/dw-edma-v0-core.c
+++ b/drivers/dma/dw-edma/dw-edma-v0-core.c
@@ -192,7 +192,7 @@ static inline void writeq_ch(struct dw_edma *dw, enum dw_edma_dir dir, u16 ch,
static inline u64 readq_ch(struct dw_edma *dw, enum dw_edma_dir dir, u16 ch,
const void __iomem *addr)
{
- u32 value;
+ u64 value;

if (dw->chip->mf == EDMA_MF_EDMA_LEGACY) {
u32 viewport_sel;
--
2.39.0


--jmygqfxykzmay6uj
Content-Type: text/x-patch; charset=us-ascii
Content-Disposition: attachment;
filename="v10-0020-dmaengine-dw-edma-Use-non-atomic-io-64-methods.patch"