From 3aa204fb3138c43e63b868e488277f13b098cef1 Mon Sep 17 00:00:00 2001 From: Darek Stojaczyk Date: Fri, 15 Mar 2019 13:39:08 +0100 Subject: [PATCH] ioat: don't rely on phys_addr retrieved from spdk_malloc() The phys_addr param in spdk_*malloc() is about to be deprecated, so use a separate spdk_vtophys() call to retrieve physical addresses. This patch also adds error checks against SPDK_VTOPHYS_ERROR. The error handling paths are already there to account for spdk_*malloc() failures themselves, so reuse them in case of vtophys failures. Change-Id: Ic1d9194a9a2052a46fc6f7990f53aa91b4a8bbc3 Signed-off-by: Darek Stojaczyk Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/416994 Tested-by: SPDK CI Jenkins Reviewed-by: Changpeng Liu Reviewed-by: Jim Harris Reviewed-by: Shuhei Matsumoto --- lib/ioat/ioat.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/ioat/ioat.c b/lib/ioat/ioat.c index 6d73d61bc..94a2eda33 100644 --- a/lib/ioat/ioat.c +++ b/lib/ioat/ioat.c @@ -414,11 +414,17 @@ ioat_channel_start(struct spdk_ioat_chan *ioat) } ioat->comp_update = spdk_dma_zmalloc(sizeof(*ioat->comp_update), SPDK_IOAT_CHANCMP_ALIGN, - &comp_update_bus_addr); + NULL); if (ioat->comp_update == NULL) { return -1; } + comp_update_bus_addr = spdk_vtophys((void *)ioat->comp_update, NULL); + if (comp_update_bus_addr == SPDK_VTOPHYS_ERROR) { + spdk_dma_free((void *)ioat->comp_update); + return -1; + } + ioat->ring_size_order = IOAT_DEFAULT_ORDER; num_descriptors = 1 << ioat->ring_size_order;