[PATCH 1/2] drm/nouveau: Use vmalloc_array to simplify code

Qianfeng Rong posted 2 patches 1 month, 2 weeks ago
[PATCH 1/2] drm/nouveau: Use vmalloc_array to simplify code
Posted by Qianfeng Rong 1 month, 2 weeks ago
Use vmalloc_array() instead of vmalloc() to simplify the functions
nv84_fence_suspend().

vmalloc_array() is also optimized better, resulting in less instructions
being used.

Signed-off-by: Qianfeng Rong <rongqianfeng@vivo.com>
---
 drivers/gpu/drm/nouveau/nv84_fence.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/nouveau/nv84_fence.c b/drivers/gpu/drm/nouveau/nv84_fence.c
index 1765b2cedaf9..63a477e631ae 100644
--- a/drivers/gpu/drm/nouveau/nv84_fence.c
+++ b/drivers/gpu/drm/nouveau/nv84_fence.c
@@ -158,7 +158,7 @@ nv84_fence_suspend(struct nouveau_drm *drm)
 	struct nv84_fence_priv *priv = drm->fence;
 	int i;
 
-	priv->suspend = vmalloc(array_size(sizeof(u32), drm->chan_total));
+	priv->suspend = vmalloc_array(drm->chan_total, sizeof(u32));
 	if (priv->suspend) {
 		for (i = 0; i < drm->chan_total; i++)
 			priv->suspend[i] = nouveau_bo_rd32(priv->bo, i*4);
-- 
2.34.1