Merge "msm: ais: sensor: validating the flash initialization parameters"
This commit is contained in:
commit
bc72999165
1 changed files with 32 additions and 9 deletions
|
@ -504,23 +504,46 @@ static int32_t msm_flash_init(
|
|||
}
|
||||
|
||||
flash_ctrl->flash_state = MSM_CAMERA_FLASH_INIT;
|
||||
|
||||
CDBG("Exit");
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_COMPAT
|
||||
static int32_t msm_flash_init_prepare(
|
||||
struct msm_flash_ctrl_t *flash_ctrl,
|
||||
struct msm_flash_cfg_data_t *flash_data)
|
||||
{
|
||||
#ifdef CONFIG_COMPAT
|
||||
struct msm_flash_cfg_data_t flash_data_k;
|
||||
struct msm_flash_init_info_t flash_init_info;
|
||||
int32_t i = 0;
|
||||
|
||||
if (!is_compat_task()) {
|
||||
/*for 64-bit usecase,it need copy the data to local memory*/
|
||||
flash_data_k.cfg_type = flash_data->cfg_type;
|
||||
for (i = 0; i < MAX_LED_TRIGGERS; i++) {
|
||||
flash_data_k.flash_current[i] =
|
||||
flash_data->flash_current[i];
|
||||
flash_data_k.flash_duration[i] =
|
||||
flash_data->flash_duration[i];
|
||||
}
|
||||
|
||||
flash_data_k.cfg.flash_init_info = &flash_init_info;
|
||||
if (copy_from_user(&flash_init_info,
|
||||
(void __user *)(flash_data->cfg.flash_init_info),
|
||||
sizeof(struct msm_flash_init_info_t))) {
|
||||
pr_err("%s copy_from_user failed %d\n",
|
||||
__func__, __LINE__);
|
||||
return -EFAULT;
|
||||
}
|
||||
return msm_flash_init(flash_ctrl, &flash_data_k);
|
||||
}
|
||||
/*
|
||||
* for 32-bit usecase,it already copy the userspace
|
||||
* data to local memory in msm_flash_subdev_do_ioctl()
|
||||
* so here do not need copy from user
|
||||
*/
|
||||
return msm_flash_init(flash_ctrl, flash_data);
|
||||
}
|
||||
#else
|
||||
static int32_t msm_flash_init_prepare(
|
||||
struct msm_flash_ctrl_t *flash_ctrl,
|
||||
struct msm_flash_cfg_data_t *flash_data)
|
||||
{
|
||||
struct msm_flash_cfg_data_t flash_data_k;
|
||||
struct msm_flash_init_info_t flash_init_info;
|
||||
int32_t i = 0;
|
||||
|
@ -535,15 +558,15 @@ static int32_t msm_flash_init_prepare(
|
|||
|
||||
flash_data_k.cfg.flash_init_info = &flash_init_info;
|
||||
if (copy_from_user(&flash_init_info,
|
||||
(void *)(flash_data->cfg.flash_init_info),
|
||||
(void __user *)(flash_data->cfg.flash_init_info),
|
||||
sizeof(struct msm_flash_init_info_t))) {
|
||||
pr_err("%s copy_from_user failed %d\n",
|
||||
__func__, __LINE__);
|
||||
return -EFAULT;
|
||||
}
|
||||
return msm_flash_init(flash_ctrl, &flash_data_k);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static int32_t msm_flash_low(
|
||||
struct msm_flash_ctrl_t *flash_ctrl,
|
||||
|
|
Loading…
Add table
Reference in a new issue