Skip to content

Commit

Permalink
Revert "msm: camera_v3: reqmgr: Avoid freeing subdev twice"
Browse files Browse the repository at this point in the history
This reverts commit 3d70fa47d7fa0c534128ced9c6a37ef18cf31157.

Change-Id: 93102f3649e7dcdbec6a8db8e68604b3290cb03f
Signed-off-by: TogoFire <togofire@mailfence.com>
  • Loading branch information
bananafunction authored and TogoFire committed Apr 21, 2023
1 parent 6cb3df3 commit 3f8accc
Showing 1 changed file with 6 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* Copyright (c) 2016-2020, The Linux Foundation. All rights reserved.
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
Expand Down Expand Up @@ -1615,13 +1614,10 @@ static int __cam_req_mgr_create_subdevs(
*
*/
static void __cam_req_mgr_destroy_subdev(
struct cam_req_mgr_connected_device **l_device)
struct cam_req_mgr_connected_device *l_device)
{
CAM_DBG(CAM_CRM, "*l_device %pK", *l_device);
if (*(l_device) != NULL) {
kfree(*(l_device));
*l_device = NULL;
}
kfree(l_device);
l_device = NULL;
}

/**
Expand Down Expand Up @@ -2810,7 +2806,7 @@ static int __cam_req_mgr_unlink(struct cam_req_mgr_core_link *link)
__cam_req_mgr_destroy_link_info(link);

/* Free memory holding data of linked devs */
__cam_req_mgr_destroy_subdev(&link->l_dev);
__cam_req_mgr_destroy_subdev(link->l_dev);

/* Destroy the link handle */
rc = cam_destroy_device_hdl(link->link_hdl);
Expand Down Expand Up @@ -2973,7 +2969,7 @@ int cam_req_mgr_link(struct cam_req_mgr_ver_info *link_info)
mutex_unlock(&g_crm_core_dev->crm_lock);
return rc;
setup_failed:
__cam_req_mgr_destroy_subdev(&link->l_dev);
__cam_req_mgr_destroy_subdev(link->l_dev);
create_subdev_failed:
cam_destroy_device_hdl(link->link_hdl);
link_info->u.link_info_v1.link_hdl = -1;
Expand Down Expand Up @@ -3082,7 +3078,7 @@ int cam_req_mgr_link_v2(struct cam_req_mgr_ver_info *link_info)
mutex_unlock(&g_crm_core_dev->crm_lock);
return rc;
setup_failed:
__cam_req_mgr_destroy_subdev(&link->l_dev);
__cam_req_mgr_destroy_subdev(link->l_dev);
create_subdev_failed:
cam_destroy_device_hdl(link->link_hdl);
link_info->u.link_info_v2.link_hdl = -1;
Expand Down

0 comments on commit 3f8accc

Please sign in to comment.