From 3f8accc16f015ef844ccc91564d1b4b588c60650 Mon Sep 17 00:00:00 2001 From: bananafunction Date: Wed, 29 Mar 2023 19:33:28 +0200 Subject: [PATCH] Revert "msm: camera_v3: reqmgr: Avoid freeing subdev twice" This reverts commit 3d70fa47d7fa0c534128ced9c6a37ef18cf31157. Change-Id: 93102f3649e7dcdbec6a8db8e68604b3290cb03f Signed-off-by: TogoFire --- .../msm/camera_v3/cam_req_mgr/cam_req_mgr_core.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/drivers/media/platform/msm/camera_v3/cam_req_mgr/cam_req_mgr_core.c b/drivers/media/platform/msm/camera_v3/cam_req_mgr/cam_req_mgr_core.c index a41f2d5a6d0e..eb3d0de873b3 100644 --- a/drivers/media/platform/msm/camera_v3/cam_req_mgr/cam_req_mgr_core.c +++ b/drivers/media/platform/msm/camera_v3/cam_req_mgr/cam_req_mgr_core.c @@ -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 @@ -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; } /** @@ -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); @@ -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; @@ -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;