[PATCH 15/28] mfd: loongson-se: Check return value of dma_set_mask_and_coherent()

From: Lee Jones

Date: Wed Oct 21 2026 - 08:26:20 EST


loongson_se_probe() ignores the return value of
dma_set_mask_and_coherent() when requesting a 64-bit DMA mask before
allocating coherent DMA memory. Check the return value and abort probe
if the platform cannot satisfy the 64-bit DMA mask requirement.

Fixes: e551fa3159e3 ("mfd: Add support for Loongson Security Engine chip controller")
Closes: https://sashiko.dev/#/bug/linux-6685ee0c-b7ed-4f21-8800-cc705cec449b
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Lee Jones <lee@xxxxxxxxxx>
---
drivers/mfd/loongson-se.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/mfd/loongson-se.c b/drivers/mfd/loongson-se.c
index 3902ba377d69..8dcb90a067b3 100644
--- a/drivers/mfd/loongson-se.c
+++ b/drivers/mfd/loongson-se.c
@@ -199,7 +199,10 @@ static int loongson_se_probe(struct platform_device *pdev)
spin_lock_init(&se->dev_lock);
mutex_init(&se->engine_init_lock);

- dma_set_mask_and_coherent(dev, DMA_BIT_MASK(64));
+ err = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(64));
+ if (err)
+ return err;
+
if (device_property_read_u32(dev, "dmam_size", &se->dmam_size))
return -ENODEV;

--
2.56.0.218.g1ec904b173-goog