]> git.sur5r.net Git - u-boot/blobdiff - drivers/nvme/nvme_show.c
net: gem: Check return value from memalign/malloc
[u-boot] / drivers / nvme / nvme_show.c
index 5577e5de4552c6de4adcc076d3050db2972474bf..395b0618e6448d87947dd766f173d31ce3fe4436 100644 (file)
@@ -1,13 +1,13 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * Copyright (C) 2017 NXP Semiconductors
  * Copyright (C) 2017 Bin Meng <bmeng.cn@gmail.com>
- *
- * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include <common.h>
 #include <dm.h>
 #include <errno.h>
+#include <memalign.h>
 #include <nvme.h>
 #include "nvme.h"
 
@@ -106,8 +106,10 @@ int nvme_print_info(struct udevice *udev)
 {
        struct nvme_ns *ns = dev_get_priv(udev);
        struct nvme_dev *dev = ns->dev;
-       struct nvme_id_ns buf_ns, *id = &buf_ns;
-       struct nvme_id_ctrl buf_ctrl, *ctrl = &buf_ctrl;
+       ALLOC_CACHE_ALIGN_BUFFER(char, buf_ns, sizeof(struct nvme_id_ns));
+       struct nvme_id_ns *id = (struct nvme_id_ns *)buf_ns;
+       ALLOC_CACHE_ALIGN_BUFFER(char, buf_ctrl, sizeof(struct nvme_id_ctrl));
+       struct nvme_id_ctrl *ctrl = (struct nvme_id_ctrl *)buf_ctrl;
 
        if (nvme_identify(dev, 0, 1, (dma_addr_t)ctrl))
                return -EIO;