msm: camera: common: Add cam_free_clear to cam_compat

Kernel 5.10 and up have renamed kzfree to kfree_secure. As such,
we have added a cam_free_clear function to redirect all uses of kzfree
uses to the appropriate function depending on the kernel version the
driver is built against.

CRs-Fixed: 2835738
Change-Id: I72d191c9fb0454a4dbb1392894a909e81fe07caa
Signed-off-by: Karthik Jayakumar <kjayakum@codeaurora.org>
This commit is contained in:
Karthik Jayakumar
2020-12-07 15:13:39 -08:00
کامیت شده توسط Gerrit - the friendly Code Review server
والد e7f96de4c3
کامیت 2c67e897da
10فایلهای تغییر یافته به همراه57 افزوده شده و 29 حذف شده

مشاهده پرونده

@@ -5,13 +5,14 @@
#include <linux/dma-mapping.h>
#include <linux/of_address.h>
#include <linux/slab.h>
#include "cam_compat.h"
#include "cam_debug_util.h"
#include "cam_cpas_api.h"
#include "camera_main.h"
#if KERNEL_VERSION(5, 4, 0) <= LINUX_VERSION_CODE
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 4, 0)
int cam_reserve_icp_fw(struct cam_fw_alloc_info *icp_fw, size_t fw_length)
{
int rc = 0;
@@ -189,6 +190,18 @@ static int camera_platform_compare_dev(struct device *dev, void *data)
}
#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0)
void cam_free_clear(const void * ptr)
{
kfree_sensitive(ptr);
}
#else
void cam_free_clear(const void * ptr)
{
kzfree(ptr);
}
#endif
/* Callback to compare device from match list before adding as component */
static inline int camera_component_compare_dev(struct device *dev, void *data)
{
@@ -209,7 +222,7 @@ int camera_component_match_add_drivers(struct device *master_dev,
}
for (i = 0; i < ARRAY_SIZE(cam_component_drivers); i++) {
#if KERNEL_VERSION(5, 4, 0) <= LINUX_VERSION_CODE
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 4, 0)
struct device_driver const *drv =
&cam_component_drivers[i]->driver;
const void *drv_ptr = (const void *)drv;

مشاهده پرونده

@@ -13,7 +13,13 @@
#include "cam_csiphy_dev.h"
#include "cam_cpastop_hw.h"
#if KERNEL_VERSION(5, 4, 0) <= LINUX_VERSION_CODE
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 7, 0)
#define VFL_TYPE_VIDEO VFL_TYPE_GRABBER
#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 4, 0)
#include <linux/msm_ion.h>
#include <linux/ion.h>
@@ -41,5 +47,6 @@ int camera_component_match_add_drivers(struct device *master_dev,
struct component_match **match_list);
int cam_csiphy_notify_secure_mode(struct csiphy_device *csiphy_dev,
bool protect, int32_t offset);
void cam_free_clear(const void *);
#endif /* _CAM_COMPAT_H_ */