diff --git a/drivers/cam_cust/cam_custom_hw_mgr/cam_custom_csid/cam_custom_csid_dev.c b/drivers/cam_cust/cam_custom_hw_mgr/cam_custom_csid/cam_custom_csid_dev.c index 124be99d40..aeed9b8daf 100644 --- a/drivers/cam_cust/cam_custom_hw_mgr/cam_custom_csid/cam_custom_csid_dev.c +++ b/drivers/cam_cust/cam_custom_hw_mgr/cam_custom_csid/cam_custom_csid_dev.c @@ -1,6 +1,7 @@ // SPDX-License-Identifier: GPL-2.0-only /* * Copyright (c) 2019-2021, The Linux Foundation. All rights reserved. + * Copyright (c) 2023, Qualcomm Innovation Center, Inc. All rights reserved. */ #include @@ -107,13 +108,19 @@ err: static void cam_custom_csid_component_unbind(struct device *dev, struct device *master_dev, void *data) { - struct cam_hw_intf *csid_hw_intf; + struct cam_hw_intf *csid_hw_intf = NULL; struct cam_hw_info *csid_hw_info; struct cam_ife_csid_core_info *core_info = NULL; struct platform_device *pdev = to_platform_device(dev); const struct of_device_id *match_dev = NULL; csid_hw_intf = (struct cam_hw_intf *)platform_get_drvdata(pdev); + + if (!csid_hw_intf) { + CAM_ERR(CAM_CUSTOM, "ERROR No data in csid_hw_intf"); + return; + } + csid_hw_info = csid_hw_intf->hw_priv; core_info = csid_hw_info->core_info; diff --git a/drivers/cam_icp/icp_hw/bps_hw/bps_dev.c b/drivers/cam_icp/icp_hw/bps_hw/bps_dev.c index 8dfddd452b..18b29f3a17 100644 --- a/drivers/cam_icp/icp_hw/bps_hw/bps_dev.c +++ b/drivers/cam_icp/icp_hw/bps_hw/bps_dev.c @@ -1,7 +1,7 @@ // SPDX-License-Identifier: GPL-2.0-only /* * Copyright (c) 2017-2021, The Linux Foundation. All rights reserved. - * Copyright (c) 2022, Qualcomm Innovation Center, Inc. All rights reserved. + * Copyright (c) 2022-2023, Qualcomm Innovation Center, Inc. All rights reserved. */ #include @@ -205,6 +205,12 @@ static void cam_bps_component_unbind(struct device *dev, CAM_DBG(CAM_ICP, "Unbinding component: %s", pdev->name); bps_dev_intf = platform_get_drvdata(pdev); + + if (!bps_dev_intf) { + CAM_ERR(CAM_ICP, "Error No data in pdev"); + return; + } + bps_dev = bps_dev_intf->hw_priv; core_info = (struct cam_bps_device_core_info *)bps_dev->core_info; cam_cpas_unregister_client(core_info->cpas_handle); diff --git a/drivers/cam_icp/icp_hw/icp_proc/icp_v1_hw/cam_icp_v1_dev.c b/drivers/cam_icp/icp_hw/icp_proc/icp_v1_hw/cam_icp_v1_dev.c index 579383626f..a305a2f0c7 100644 --- a/drivers/cam_icp/icp_hw/icp_proc/icp_v1_hw/cam_icp_v1_dev.c +++ b/drivers/cam_icp/icp_hw/icp_proc/icp_v1_hw/cam_icp_v1_dev.c @@ -1,7 +1,7 @@ // SPDX-License-Identifier: GPL-2.0-only /* * Copyright (c) 2017-2020, The Linux Foundation. All rights reserved. - * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. + * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved. */ #include @@ -212,6 +212,12 @@ static void cam_icp_v1_component_unbind(struct device *dev, struct platform_device *pdev = to_platform_device(dev); icp_v1_dev_intf = platform_get_drvdata(pdev); + + if (!icp_v1_dev_intf) { + CAM_ERR(CAM_ICP, "Error No data in pdev"); + return; + } + icp_v1_dev = icp_v1_dev_intf->hw_priv; core_info = (struct cam_icp_v1_device_core_info *)icp_v1_dev->core_info; diff --git a/drivers/cam_icp/icp_hw/icp_proc/icp_v2_hw/cam_icp_v2_dev.c b/drivers/cam_icp/icp_hw/icp_proc/icp_v2_hw/cam_icp_v2_dev.c index 483812556a..41c5ff6f36 100644 --- a/drivers/cam_icp/icp_hw/icp_proc/icp_v2_hw/cam_icp_v2_dev.c +++ b/drivers/cam_icp/icp_hw/icp_proc/icp_v2_hw/cam_icp_v2_dev.c @@ -1,7 +1,7 @@ // SPDX-License-Identifier: GPL-2.0-only /* * Copyright (c) 2021, The Linux Foundation. All rights reserved. - * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. + * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved. */ #include @@ -165,8 +165,17 @@ static void cam_icp_v2_component_unbind(struct device *dev, struct device *mdev, void *data) { struct platform_device *pdev = to_platform_device(dev); - struct cam_hw_intf *icp_v2_intf = platform_get_drvdata(pdev); - struct cam_hw_info *icp_v2_info = icp_v2_intf->hw_priv; + struct cam_hw_intf *icp_v2_intf = NULL; + struct cam_hw_info *icp_v2_info = NULL; + + icp_v2_intf = platform_get_drvdata(pdev); + + if (!icp_v2_intf) { + CAM_ERR(CAM_ICP, "Error No data in pdev"); + return; + } + + icp_v2_info = icp_v2_intf->hw_priv; cam_icp_v2_cpas_unregister(icp_v2_intf); cam_icp_soc_resources_deinit(&icp_v2_info->soc_info); diff --git a/drivers/cam_icp/icp_hw/ipe_hw/ipe_dev.c b/drivers/cam_icp/icp_hw/ipe_hw/ipe_dev.c index 99ac506dc6..f527d4f113 100644 --- a/drivers/cam_icp/icp_hw/ipe_hw/ipe_dev.c +++ b/drivers/cam_icp/icp_hw/ipe_hw/ipe_dev.c @@ -188,6 +188,12 @@ static void cam_ipe_component_unbind(struct device *dev, CAM_DBG(CAM_ICP, "Unbinding component: %s", pdev->name); ipe_dev_intf = platform_get_drvdata(pdev); + + if (!ipe_dev_intf) { + CAM_ERR(CAM_ICP, "Error No data in pdev"); + return; + } + ipe_dev = ipe_dev_intf->hw_priv; core_info = (struct cam_ipe_device_core_info *)ipe_dev->core_info; cam_cpas_unregister_client(core_info->cpas_handle); diff --git a/drivers/cam_icp/icp_hw/ofe_hw/ofe_dev.c b/drivers/cam_icp/icp_hw/ofe_hw/ofe_dev.c index baa5828b9f..f73046ac77 100644 --- a/drivers/cam_icp/icp_hw/ofe_hw/ofe_dev.c +++ b/drivers/cam_icp/icp_hw/ofe_hw/ofe_dev.c @@ -184,6 +184,12 @@ static void cam_ofe_component_unbind(struct device *dev, CAM_DBG(CAM_ICP, "Unbinding component: %s", pdev->name); ofe_dev_intf = platform_get_drvdata(pdev); + + if (!ofe_dev_intf) { + CAM_ERR(CAM_ICP, "Error No data in pdev"); + return; + } + ofe_dev = ofe_dev_intf->hw_priv; core_info = (struct cam_ofe_device_core_info *)ofe_dev->core_info; cam_cpas_unregister_client(core_info->cpas_handle); diff --git a/drivers/cam_isp/isp_hw_mgr/isp_hw/ife_csid_hw/cam_ife_csid_dev.c b/drivers/cam_isp/isp_hw_mgr/isp_hw/ife_csid_hw/cam_ife_csid_dev.c index 8a3dfa1546..f5c7eeebf0 100644 --- a/drivers/cam_isp/isp_hw_mgr/isp_hw/ife_csid_hw/cam_ife_csid_dev.c +++ b/drivers/cam_isp/isp_hw_mgr/isp_hw/ife_csid_hw/cam_ife_csid_dev.c @@ -116,6 +116,12 @@ static void cam_ife_csid_component_unbind(struct device *dev, const struct of_device_id *match_dev = NULL; hw_intf = (struct cam_hw_intf *)platform_get_drvdata(pdev); + + if (!hw_intf) { + CAM_ERR(CAM_ISP, "Error No data in hw_intf"); + return; + } + hw_info = hw_intf->hw_priv; CAM_DBG(CAM_ISP, "CSID:%d component unbind", diff --git a/drivers/cam_isp/isp_hw_mgr/isp_hw/ppi_hw/cam_csid_ppi_dev.c b/drivers/cam_isp/isp_hw_mgr/isp_hw/ppi_hw/cam_csid_ppi_dev.c index d1fb5b7dd6..99a17b9957 100644 --- a/drivers/cam_isp/isp_hw_mgr/isp_hw/ppi_hw/cam_csid_ppi_dev.c +++ b/drivers/cam_isp/isp_hw_mgr/isp_hw/ppi_hw/cam_csid_ppi_dev.c @@ -1,6 +1,7 @@ // SPDX-License-Identifier: GPL-2.0-only /* * Copyright (c) 2020-2021, The Linux Foundation. All rights reserved. + * Copyright (c) 2023, Qualcomm Innovation Center, Inc. All rights reserved. */ #include @@ -108,6 +109,12 @@ static void cam_ppi_component_unbind(struct device *dev, struct platform_device *pdev = to_platform_device(dev); ppi_dev = (struct cam_csid_ppi_hw *)platform_get_drvdata(pdev); + + if (!ppi_dev) { + CAM_ERR(CAM_ISP, "Error No data in ppi_dev"); + return; + } + ppi_hw_intf = ppi_dev->hw_intf; ppi_hw_info = ppi_dev->hw_info; diff --git a/drivers/cam_isp/isp_hw_mgr/isp_hw/tfe_csid_hw/cam_tfe_csid_dev.c b/drivers/cam_isp/isp_hw_mgr/isp_hw/tfe_csid_hw/cam_tfe_csid_dev.c index d4dde1a8fd..9c43612f57 100644 --- a/drivers/cam_isp/isp_hw_mgr/isp_hw/tfe_csid_hw/cam_tfe_csid_dev.c +++ b/drivers/cam_isp/isp_hw_mgr/isp_hw/tfe_csid_hw/cam_tfe_csid_dev.c @@ -1,6 +1,7 @@ // SPDX-License-Identifier: GPL-2.0-only /* * Copyright (c) 2019-2021, The Linux Foundation. All rights reserved. + * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved. */ #include @@ -107,6 +108,12 @@ void cam_tfe_csid_component_unbind(struct device *dev, struct platform_device *pdev = to_platform_device(dev); csid_dev = (struct cam_tfe_csid_hw *)platform_get_drvdata(pdev); + + if (!csid_dev) { + CAM_ERR(CAM_ISP, "Error No data in csid_dev"); + return; + } + csid_hw_intf = csid_dev->hw_intf; csid_hw_info = csid_dev->hw_info; diff --git a/drivers/cam_sensor_module/cam_cci/cam_cci_dev.c b/drivers/cam_sensor_module/cam_cci/cam_cci_dev.c index c92da6001b..5bb645babc 100644 --- a/drivers/cam_sensor_module/cam_cci/cam_cci_dev.c +++ b/drivers/cam_sensor_module/cam_cci/cam_cci_dev.c @@ -560,8 +560,17 @@ static void cam_cci_component_unbind(struct device *dev, struct platform_device *pdev = to_platform_device(dev); struct v4l2_subdev *subdev = platform_get_drvdata(pdev); - struct cci_device *cci_dev = - v4l2_get_subdevdata(subdev); + struct cci_device *cci_dev = cci_dev = v4l2_get_subdevdata(subdev); + + if (!subdev) { + CAM_ERR(CAM_CCI, "Error No data in subdev"); + return; + } + + if (!cci_dev) { + CAM_ERR(CAM_CCI, "Error No data in cci_dev"); + return; + } if (!cci_dev) { CAM_ERR(CAM_CCI, "cci_dev NULL"); 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 b4fb2567c2..1e6248a5f1 100644 --- a/drivers/cam_sensor_module/cam_csiphy/cam_csiphy_dev.c +++ b/drivers/cam_sensor_module/cam_csiphy/cam_csiphy_dev.c @@ -607,8 +607,22 @@ static void cam_csiphy_component_unbind(struct device *dev, { struct platform_device *pdev = to_platform_device(dev); - struct v4l2_subdev *subdev = platform_get_drvdata(pdev); - struct csiphy_device *csiphy_dev = v4l2_get_subdevdata(subdev); + struct v4l2_subdev *subdev = NULL; + struct csiphy_device *csiphy_dev = NULL; + + subdev = platform_get_drvdata(pdev); + + if (!subdev) { + CAM_ERR(CAM_CSIPHY, "Error No data in subdev"); + return; + } + + csiphy_dev = v4l2_get_subdevdata(subdev); + + if (!csiphy_dev) { + CAM_ERR(CAM_CSIPHY, "Error No data in csiphy_dev"); + return; + } if (!csiphy_dev) { CAM_ERR(CAM_CSIPHY, "csiphy_dev ptr is NULL"); diff --git a/drivers/cam_sensor_module/cam_tpg/cam_tpg_dev.c b/drivers/cam_sensor_module/cam_tpg/cam_tpg_dev.c index 780f2a3485..910199b9a6 100644 --- a/drivers/cam_sensor_module/cam_tpg/cam_tpg_dev.c +++ b/drivers/cam_sensor_module/cam_tpg/cam_tpg_dev.c @@ -336,7 +336,14 @@ static void cam_tpg_component_unbind(struct device *dev, struct device *master_dev, void *data) { struct platform_device *pdev = to_platform_device(dev); - struct cam_tpg_device *tpg_dev = platform_get_drvdata(pdev); + struct cam_tpg_device *tpg_dev = NULL; + + tpg_dev = platform_get_drvdata(pdev); + + if (!tpg_dev) { + CAM_ERR(CAM_TPG, "Error No data in tpg_dev"); + return; + } CAM_INFO(CAM_TPG, "Unbind TPG component"); cam_cpas_unregister_client(tpg_dev->cpas_handle);