From: farah kassabri Date: Sun, 8 Jan 2023 15:33:44 +0000 (+0200) Subject: habanalabs: bugs fixes in timestamps buff alloc X-Git-Tag: v6.1.21~1123 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=deb9379af500d8c3181e59d122069d102fa4ec79;p=platform%2Fkernel%2Flinux-starfive.git habanalabs: bugs fixes in timestamps buff alloc [ Upstream commit 1693fef9e95dbe8ab767d208a02328fff13fbb94 ] use argument instead of fixed GFP value for allocation in Timestamps buffers alloc function. change data type of size to size_t. Fixes: 9158bf69e74f ("habanalabs: Timestamps buffers registration") Signed-off-by: farah kassabri Reviewed-by: Oded Gabbay Signed-off-by: Oded Gabbay Signed-off-by: Sasha Levin --- diff --git a/drivers/misc/habanalabs/common/memory.c b/drivers/misc/habanalabs/common/memory.c index ef28f3b37..a49038d 100644 --- a/drivers/misc/habanalabs/common/memory.c +++ b/drivers/misc/habanalabs/common/memory.c @@ -2089,12 +2089,13 @@ static int hl_ts_mmap(struct hl_mmap_mem_buf *buf, struct vm_area_struct *vma, v static int hl_ts_alloc_buf(struct hl_mmap_mem_buf *buf, gfp_t gfp, void *args) { struct hl_ts_buff *ts_buff = NULL; - u32 size, num_elements; + u32 num_elements; + size_t size; void *p; num_elements = *(u32 *)args; - ts_buff = kzalloc(sizeof(*ts_buff), GFP_KERNEL); + ts_buff = kzalloc(sizeof(*ts_buff), gfp); if (!ts_buff) return -ENOMEM;