aboutsummaryrefslogtreecommitdiff
path: root/drivers/nvme
diff options
context:
space:
mode:
authorBin Meng <bmeng.cn@gmail.com>2017-08-22 08:15:08 -0700
committerTom Rini <trini@konsulko.com>2017-08-28 07:17:11 -0400
commit099c2015b02352df9c829acbdc3d8e6e683011a5 (patch)
tree0d13e5e7ca9943095db67ce3561c1169b72f1f9e /drivers/nvme
parente5dc2d266539786730eab6cac3c3e26dcb8abc87 (diff)
downloadu-boot-099c2015b02352df9c829acbdc3d8e6e683011a5.zip
u-boot-099c2015b02352df9c829acbdc3d8e6e683011a5.tar.gz
u-boot-099c2015b02352df9c829acbdc3d8e6e683011a5.tar.bz2
nvme: Fix ndev->queues allocation
ndev->queues is a pointer to pointer, but the allocation wrongly requests sizeof(struct nvme_queue). Fix it. Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Diffstat (limited to 'drivers/nvme')
-rw-r--r--drivers/nvme/nvme.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/nvme/nvme.c b/drivers/nvme/nvme.c
index 2ac0870..5d39cab 100644
--- a/drivers/nvme/nvme.c
+++ b/drivers/nvme/nvme.c
@@ -785,13 +785,13 @@ static int nvme_probe(struct udevice *udev)
goto free_nvme;
}
- ndev->queues = malloc(2 * sizeof(struct nvme_queue));
+ ndev->queues = malloc(2 * sizeof(struct nvme_queue *));
if (!ndev->queues) {
ret = -ENOMEM;
printf("Error: %s: Out of memory!\n", udev->name);
goto free_nvme;
}
- memset(ndev->queues, 0, sizeof(2 * sizeof(struct nvme_queue)));
+ memset(ndev->queues, 0, sizeof(2 * sizeof(struct nvme_queue *)));
ndev->prp_pool = malloc(MAX_PRP_POOL);
if (!ndev->prp_pool) {