[PATCH] nvme: apple: Check memalign return value

Francois Berder fberder at outlook.fr
Sat May 9 22:13:31 CEST 2026


memalign returns NULL if it fails.
This commit ensures that we handle this failure before
filling the buffer with 0s.

Signed-off-by: Francois Berder <fberder at outlook.fr>
---
 drivers/nvme/nvme_apple.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/nvme/nvme_apple.c b/drivers/nvme/nvme_apple.c
index 7e7538553e3..46af1d716ff 100644
--- a/drivers/nvme/nvme_apple.c
+++ b/drivers/nvme/nvme_apple.c
@@ -87,6 +87,9 @@ static int apple_nvme_setup_queue(struct nvme_queue *nvmeq)
 	}
 
 	priv->tcbs[nvmeq->qid] = (void *)memalign(4096, ANS_NVMMU_TCB_SIZE);
+	if (!priv->tcbs[nvmeq->qid])
+		return -ENOMEM;
+
 	memset((void *)priv->tcbs[nvmeq->qid], 0, ANS_NVMMU_TCB_SIZE);
 
 	switch (nvmeq->qid) {
-- 
2.43.0


More information about the U-Boot mailing list