[PATCH] media: atomisp: do not free kmalloc memory by vfree

From: Jiri Slaby
Date: Fri Feb 19 2021 - 05:13:35 EST


fw_minibuffer[i].buffer is allocated by kmalloc in sh_css_load_blob_info
and by vmalloc in setup_binary. So use kvfree to decide which of those
allocators to use for freeing.

Also remove the useless cast.

Signed-off-by: Jiri Slaby <jslaby@xxxxxxx>
Cc: Mauro Carvalho Chehab <mchehab+huawei@xxxxxxxxxx>
---
drivers/staging/media/atomisp/pci/sh_css_firmware.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/media/atomisp/pci/sh_css_firmware.c b/drivers/staging/media/atomisp/pci/sh_css_firmware.c
index db25e39bea88..f4ce8ace9d50 100644
--- a/drivers/staging/media/atomisp/pci/sh_css_firmware.c
+++ b/drivers/staging/media/atomisp/pci/sh_css_firmware.c
@@ -366,7 +366,7 @@ void sh_css_unload_firmware(void)
if (fw_minibuffer[i].name)
kfree((void *)fw_minibuffer[i].name);
if (fw_minibuffer[i].buffer)
- vfree((void *)fw_minibuffer[i].buffer);
+ kvfree(fw_minibuffer[i].buffer);
}
kfree(fw_minibuffer);
fw_minibuffer = NULL;
--
2.30.1