From 41716fade55176e8d73865491fec824e9a78784d Mon Sep 17 00:00:00 2001 From: Alok Chauhan Date: Fri, 30 Apr 2021 16:11:43 +0530 Subject: [PATCH] msm: camera: req_mgr: Fix deadlock in ICP driver in close sequence ICP driver is not releasing mutex in error scenario in close sequence and causing deadlock further in open. Fix the deadlock and avoid prints in other driver while close in provider crash. CRs-Fixed: 2938073 Change-Id: I226c9a8e9b2d0c30e90282b11fbd15ea0b085f87 Signed-off-by: Alok Chauhan --- drivers/cam_icp/cam_icp_subdev.c | 4 ++-- drivers/cam_sensor_module/cam_actuator/cam_actuator_dev.c | 2 +- drivers/cam_sensor_module/cam_csiphy/cam_csiphy_dev.c | 2 +- drivers/cam_sensor_module/cam_eeprom/cam_eeprom_dev.c | 2 +- drivers/cam_sensor_module/cam_flash/cam_flash_dev.c | 2 +- drivers/cam_sensor_module/cam_ois/cam_ois_dev.c | 2 +- drivers/cam_sensor_module/cam_sensor/cam_sensor_dev.c | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/cam_icp/cam_icp_subdev.c b/drivers/cam_icp/cam_icp_subdev.c index 3288964444ef..1a3be9b64ad5 100644 --- a/drivers/cam_icp/cam_icp_subdev.c +++ b/drivers/cam_icp/cam_icp_subdev.c @@ -107,8 +107,8 @@ int cam_icp_subdev_close_internal(struct v4l2_subdev *sd, mutex_lock(&g_icp_dev.icp_lock); if (g_icp_dev.open_cnt <= 0) { - CAM_WARN(CAM_ICP, "ICP subdev is already closed"); - return 0; + CAM_DBG(CAM_ICP, "ICP subdev is already closed"); + goto end; } g_icp_dev.open_cnt--; if (!node) { diff --git a/drivers/cam_sensor_module/cam_actuator/cam_actuator_dev.c b/drivers/cam_sensor_module/cam_actuator/cam_actuator_dev.c index d51dae6d37d7..17b310eee33a 100644 --- a/drivers/cam_sensor_module/cam_actuator/cam_actuator_dev.c +++ b/drivers/cam_sensor_module/cam_actuator/cam_actuator_dev.c @@ -34,7 +34,7 @@ static int cam_actuator_subdev_close(struct v4l2_subdev *sd, bool crm_active = cam_req_mgr_is_open(CAM_ACTUATOR); if (crm_active) { - CAM_INFO(CAM_ACTUATOR, + CAM_DBG(CAM_ACTUATOR, "CRM is ACTIVE, close should be from CRM"); return 0; } diff --git a/drivers/cam_sensor_module/cam_csiphy/cam_csiphy_dev.c b/drivers/cam_sensor_module/cam_csiphy/cam_csiphy_dev.c index 17216d86d038..204f1df7c653 100644 --- a/drivers/cam_sensor_module/cam_csiphy/cam_csiphy_dev.c +++ b/drivers/cam_sensor_module/cam_csiphy/cam_csiphy_dev.c @@ -101,7 +101,7 @@ static int cam_csiphy_subdev_close(struct v4l2_subdev *sd, bool crm_active = cam_req_mgr_is_open(CAM_CSIPHY); if (crm_active) { - CAM_INFO(CAM_CSIPHY, "CRM is ACTIVE, close should be from CRM"); + CAM_DBG(CAM_CSIPHY, "CRM is ACTIVE, close should be from CRM"); return 0; } diff --git a/drivers/cam_sensor_module/cam_eeprom/cam_eeprom_dev.c b/drivers/cam_sensor_module/cam_eeprom/cam_eeprom_dev.c index cfcc166892d7..00d695326bcf 100644 --- a/drivers/cam_sensor_module/cam_eeprom/cam_eeprom_dev.c +++ b/drivers/cam_sensor_module/cam_eeprom/cam_eeprom_dev.c @@ -34,7 +34,7 @@ static int cam_eeprom_subdev_close(struct v4l2_subdev *sd, bool crm_active = cam_req_mgr_is_open(CAM_EEPROM); if (crm_active) { - CAM_INFO(CAM_EEPROM, "CRM is ACTIVE, close should be from CRM"); + CAM_DBG(CAM_EEPROM, "CRM is ACTIVE, close should be from CRM"); return 0; } diff --git a/drivers/cam_sensor_module/cam_flash/cam_flash_dev.c b/drivers/cam_sensor_module/cam_flash/cam_flash_dev.c index 8386d8d6b817..471b788cc211 100644 --- a/drivers/cam_sensor_module/cam_flash/cam_flash_dev.c +++ b/drivers/cam_sensor_module/cam_flash/cam_flash_dev.c @@ -260,7 +260,7 @@ static int cam_flash_subdev_close(struct v4l2_subdev *sd, bool crm_active = cam_req_mgr_is_open(CAM_FLASH); if (crm_active) { - CAM_INFO(CAM_FLASH, "CRM is ACTIVE, close should be from CRM"); + CAM_DBG(CAM_FLASH, "CRM is ACTIVE, close should be from CRM"); return 0; } diff --git a/drivers/cam_sensor_module/cam_ois/cam_ois_dev.c b/drivers/cam_sensor_module/cam_ois/cam_ois_dev.c index 94b6a9cd8271..a7616d4d19b1 100644 --- a/drivers/cam_sensor_module/cam_ois/cam_ois_dev.c +++ b/drivers/cam_sensor_module/cam_ois/cam_ois_dev.c @@ -34,7 +34,7 @@ static int cam_ois_subdev_close(struct v4l2_subdev *sd, bool crm_active = cam_req_mgr_is_open(CAM_OIS); if (crm_active) { - CAM_INFO(CAM_OIS, "CRM is ACTIVE, close should be from CRM"); + CAM_DBG(CAM_OIS, "CRM is ACTIVE, close should be from CRM"); return 0; } diff --git a/drivers/cam_sensor_module/cam_sensor/cam_sensor_dev.c b/drivers/cam_sensor_module/cam_sensor/cam_sensor_dev.c index 9c6e2f2a2060..d4982ab2311e 100644 --- a/drivers/cam_sensor_module/cam_sensor/cam_sensor_dev.c +++ b/drivers/cam_sensor_module/cam_sensor/cam_sensor_dev.c @@ -33,7 +33,7 @@ static int cam_sensor_subdev_close(struct v4l2_subdev *sd, bool crm_active = cam_req_mgr_is_open(CAM_SENSOR); if (crm_active) { - CAM_INFO(CAM_SENSOR, "CRM is ACTIVE, close should be from CRM"); + CAM_DBG(CAM_SENSOR, "CRM is ACTIVE, close should be from CRM"); return 0; }