msm: camera: common: Add a check for 0 reg-val pairs in cdm command
Add a check for reg-val count=0 in reg_random command. Count=0 in reg_random cdm command will throw an invalid command HW error. CRs-Fixed: 2916477 Change-Id: Idb8654c3752963cf5a52147d350e291208b917d0 Signed-off-by: Jigar Agrawal <jigar@codeaurora.org>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* Copyright (c) 2017-2020, The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2017-2021, The Linux Foundation. All rights reserved.
|
||||
*/
|
||||
|
||||
#include <linux/types.h>
|
||||
@@ -196,8 +196,13 @@ uint32_t cdm_required_size_dmi(void)
|
||||
return cdm_get_cmd_header_size(CAM_CDM_CMD_DMI);
|
||||
}
|
||||
|
||||
uint32_t cdm_required_size_reg_continuous(uint32_t numVals)
|
||||
uint32_t cdm_required_size_reg_continuous(uint32_t numVals)
|
||||
{
|
||||
if (!numVals) {
|
||||
CAM_WARN(CAM_CDM, "numVals cant be 0");
|
||||
return 0;
|
||||
}
|
||||
|
||||
return cdm_get_cmd_header_size(CAM_CDM_CMD_REG_CONT) + numVals;
|
||||
}
|
||||
|
||||
@@ -300,6 +305,11 @@ uint32_t *cdm_write_regrandom(uint32_t *pCmdBuffer, uint32_t numRegVals,
|
||||
struct cdm_regrandom_cmd *pHeader =
|
||||
(struct cdm_regrandom_cmd *)pCmdBuffer;
|
||||
|
||||
if (!numRegVals) {
|
||||
CAM_ERR(CAM_CDM, "Number of reg-val pairs can not be 0");
|
||||
return pCmdBuffer;
|
||||
}
|
||||
|
||||
pHeader->count = numRegVals;
|
||||
pHeader->cmd = CAM_CDM_CMD_REG_RANDOM;
|
||||
pHeader->reserved = 0;
|
||||
|
Reference in New Issue
Block a user