Skip to contentSkip to conversation

EDAC: altera: Delete an inappropriate dma_free_coherent() call in altr_sdr_mc_err_inject_write()

PATCH New Salah Triki 1 participant 1 message Aug 25, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 EDAC: altera: Delete an inappropriate dma_free_coherent() call in altr_sdr_mc_err_inject_write()

dma_free_coherent() must only be called if the corresponding dma_alloc_coherent() call has succeeded. Calling it when the allocation fails leads to undefined behavior, so remove it.

Fixes 71bcada88b0f3 ("edac: altera: Add Altera SDRAM EDAC support")
Cc Markus Elfring <[email protected]>
Cc Dinh Nguyen <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc Tony Luck <[email protected]>
Cc James Morse <[email protected]>
Cc Mauro Carvalho Chehab <[email protected]>
Cc Robert Richter <[email protected]>

---
Changes in v2:
- Improve commit message, as suggested by Markus Elfring.
- Add Acked-by: Dinh Nguyen <[email protected]>

 drivers/edac/altera_edac.c | 1 -
 1 file changed, 1 deletion(-)
drivers/edac/altera_edac.c +0 -1
index cae52c654a15..7685a8550d4b 100644
@@ -128,7 +128,6 @@ static ssize_t altr_sdr_mc_err_inject_write(struct file *file,
 
 	ptemp = dma_alloc_coherent(mci->pdev, 16, &dma_handle, GFP_KERNEL);
 	if (!ptemp) {
-		dma_free_coherent(mci->pdev, 16, ptemp, dma_handle);
 		edac_printk(KERN_ERR, EDAC_MC,
 			    "Inject: Buffer Allocation error\n");
 		return -ENOMEM;
Signature · 1 line
2.43.0