From: Matthew Wilcox (Oracle) Date: Sun, 27 Sep 2020 20:29:13 +0000 (-0400) Subject: scsi: vmw_pvscsi: Use kmalloc instead of __get_free_pages X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=a3bb06dd353f76ba2b3aa3b705ca0de731849b05;p=users%2Fwilly%2Flinux.git scsi: vmw_pvscsi: Use kmalloc instead of __get_free_pages Since v5.4, kmalloc has returned naturally aligned memory for power-of-two allocations. We do not need to allocate from a special allocator any more. Signed-off-by: Matthew Wilcox (Oracle) --- diff --git a/drivers/scsi/vmw_pvscsi.c b/drivers/scsi/vmw_pvscsi.c index 081f54ab7d86..fac0de35fa29 100644 --- a/drivers/scsi/vmw_pvscsi.c +++ b/drivers/scsi/vmw_pvscsi.c @@ -1206,7 +1206,7 @@ static void pvscsi_free_sgls(const struct pvscsi_adapter *adapter) unsigned i; for (i = 0; i < adapter->req_depth; ++i, ++ctx) - free_pages((unsigned long)ctx->sgl, get_order(SGL_SIZE)); + kfree(ctx->sgl); } static void pvscsi_shutdown_intr(struct pvscsi_adapter *adapter) @@ -1272,14 +1272,12 @@ static int pvscsi_allocate_sg(struct pvscsi_adapter *adapter) BUILD_BUG_ON(sizeof(struct pvscsi_sg_list) > SGL_SIZE); for (i = 0; i < adapter->req_depth; ++i, ++ctx) { - ctx->sgl = (void *)__get_free_pages(GFP_KERNEL, - get_order(SGL_SIZE)); + ctx->sgl = kmalloc(SGL_SIZE, GFP_KERNEL); ctx->sglPA = 0; BUG_ON(!IS_ALIGNED(((unsigned long)ctx->sgl), PAGE_SIZE)); if (!ctx->sgl) { for (; i >= 0; --i, --ctx) { - free_pages((unsigned long)ctx->sgl, - get_order(SGL_SIZE)); + kfree(ctx->sgl); ctx->sgl = NULL; } return -ENOMEM;