From 9a3a7dae7a158356aecba3b174d2e21edda1aea3 Mon Sep 17 00:00:00 2001 From: Mukund Madhusudan Atre Date: Thu, 16 Jun 2022 00:25:34 -0700 Subject: [PATCH] msm: camera: csiphy: Remove dynamic memory alloc for csiphy reg info Currently during csiphy component bind, we are allocating memory for csiphy register info structure, which is not required, since the structure in statically defined in headers. This causes panic during unbind calls, since we are supplying address to statically allocated memory that we previously pointed to, during bind. Remove dynamic memory alloc and free to fix this issue. CRs-Fixed: 3223335 Change-Id: If5d029dae4660b4a57b007c895956baceac9e4b5 Signed-off-by: Mukund Madhusudan Atre --- drivers/cam_sensor_module/cam_csiphy/cam_csiphy_dev.c | 11 ----------- 1 file changed, 11 deletions(-) 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 7389bad5f1..6b13a1ea11 100644 --- a/drivers/cam_sensor_module/cam_csiphy/cam_csiphy_dev.c +++ b/drivers/cam_sensor_module/cam_csiphy/cam_csiphy_dev.c @@ -249,7 +249,6 @@ static int cam_csiphy_component_bind(struct device *dev, int32_t rc = 0; struct platform_device *pdev = to_platform_device(dev); char wq_name[32]; - int i; new_csiphy_dev = devm_kzalloc(&pdev->dev, @@ -257,13 +256,6 @@ static int cam_csiphy_component_bind(struct device *dev, if (!new_csiphy_dev) return -ENOMEM; - new_csiphy_dev->ctrl_reg = kzalloc(sizeof(struct csiphy_ctrl_t), - GFP_KERNEL); - if (!new_csiphy_dev->ctrl_reg) { - devm_kfree(&pdev->dev, new_csiphy_dev); - return -ENOMEM; - } - mutex_init(&new_csiphy_dev->mutex); new_csiphy_dev->v4l2_dev_str.pdev = pdev; @@ -377,7 +369,6 @@ csiphy_unregister_subdev: cam_unregister_subdev(&(new_csiphy_dev->v4l2_dev_str)); csiphy_no_resource: mutex_destroy(&new_csiphy_dev->mutex); - kfree(new_csiphy_dev->ctrl_reg); devm_kfree(&pdev->dev, new_csiphy_dev); return rc; } @@ -398,8 +389,6 @@ static void cam_csiphy_component_unbind(struct device *dev, cam_csiphy_shutdown(csiphy_dev); mutex_unlock(&csiphy_dev->mutex); cam_unregister_subdev(&(csiphy_dev->v4l2_dev_str)); - kfree(csiphy_dev->ctrl_reg); - csiphy_dev->ctrl_reg = NULL; platform_set_drvdata(pdev, NULL); v4l2_set_subdevdata(&(csiphy_dev->v4l2_dev_str.sd), NULL); devm_kfree(&pdev->dev, csiphy_dev);