Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f27fa268 authored by Lakshmi Narayana Kalavala's avatar Lakshmi Narayana Kalavala
Browse files

msm: camera: icp: Fix the icp resource leaks



Cleanup all the resources during the session
tear down in ICP close call sequence.

Change-Id: Ieb733927e22e5c7fc30594aaf9804980d55902ff
Signed-off-by: default avatarLakshmi Narayana Kalavala <lkalaval@codeaurora.org>
parent ffd90498
Loading
Loading
Loading
Loading
+0 −8
Original line number Diff line number Diff line
@@ -60,10 +60,6 @@ int cam_context_buf_done_from_hw(struct cam_context *ctx,
		cam_sync_signal(req->out_map_entries[j].sync_id,
			CAM_SYNC_STATE_SIGNALED_SUCCESS);
		req->num_out_acked++;
		trace_printk("Sync success req %lld, reset sync id 0x%x\n",
			req->request_id,
			req->out_map_entries[j].sync_id);

		req->out_map_entries[j].sync_id = -1;
	}

@@ -195,8 +191,6 @@ void cam_context_sync_callback(int32_t sync_obj, int status, void *data)
	req->num_in_acked++;
	if (req->num_in_acked == req->num_in_map_entries) {
		apply.request_id = req->request_id;
		trace_printk("async cb for request :%llu",
			req->request_id);
		cam_context_apply_req_to_hw(ctx, &apply);
	}
}
@@ -287,8 +281,6 @@ int32_t cam_context_prepare_dev_to_hw(struct cam_context *ctx,
		list_add_tail(&req->list, &ctx->pending_req_list);
		spin_unlock(&ctx->lock);
		for (i = 0; i < req->num_in_map_entries; i++) {
			trace_printk("register in fence callback: %d\n",
				req->in_map_entries[i].sync_id);
			rc = cam_sync_register_callback(
					cam_context_sync_callback,
					(void *)ctx,
+10 −0
Original line number Diff line number Diff line
@@ -16,6 +16,13 @@

#include "cam_node.h"

static void  __cam_node_handle_shutdown(struct cam_node *node)
{
	if (node->hw_mgr_intf.hw_close)
		node->hw_mgr_intf.hw_close(node->hw_mgr_intf.hw_mgr_priv,
			NULL);
}

static int __cam_node_handle_query_cap(struct cam_node *node,
	struct cam_query_cap_cmd *query)
{
@@ -408,6 +415,9 @@ int cam_node_handle_ioctl(struct cam_node *node, struct cam_control *cmd)
		}
		break;
	}
	case CAM_SD_SHUTDOWN:
		__cam_node_handle_shutdown(node);
		break;
	default:
		pr_err("Unknown op code %d\n", cmd->op_code);
		rc = -EINVAL;
+3 −1
Original line number Diff line number Diff line
@@ -327,7 +327,7 @@ EXPORT_SYMBOL(cam_cpas_register_client);
int cam_cpas_subdev_cmd(struct cam_cpas_intf *cpas_intf,
	struct cam_control *cmd)
{
	int rc;
	int rc = 0;

	if (!cmd) {
		pr_err("Invalid input cmd\n");
@@ -357,6 +357,8 @@ int cam_cpas_subdev_cmd(struct cam_cpas_intf *cpas_intf,

		break;
	}
	case CAM_SD_SHUTDOWN:
		break;
	default:
		pr_err("Unknown op code %d for CPAS\n", cmd->op_code);
		rc = -EINVAL;
+1 −0
Original line number Diff line number Diff line
@@ -72,6 +72,7 @@ static int cam_isp_dev_probe(struct platform_device *pdev)
	}
	node = (struct cam_node *) g_isp_dev.sd.token;

	memset(&hw_mgr_intf, 0, sizeof(hw_mgr_intf));
	rc = cam_isp_hw_mgr_init(pdev->dev.of_node, &hw_mgr_intf);
	if (rc != 0) {
		pr_err("%s: Can not initialized ISP HW manager!\n", __func__);
+12 −0
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@
#include <media/v4l2-event.h>
#include <media/v4l2-ioctl.h>
#include <media/cam_req_mgr.h>
#include <media/cam_defs.h>
#include "cam_req_mgr_dev.h"
#include "cam_req_mgr_util.h"
#include "cam_req_mgr_core.h"
@@ -151,6 +152,9 @@ static unsigned int cam_req_mgr_poll(struct file *f,

static int cam_req_mgr_close(struct file *filep)
{
	struct v4l2_subdev *sd;
	struct cam_control cam_ctrl;

	mutex_lock(&g_dev.cam_lock);

	if (g_dev.open_cnt <= 0) {
@@ -158,6 +162,14 @@ static int cam_req_mgr_close(struct file *filep)
		return -EINVAL;
	}

	cam_ctrl.op_code = CAM_SD_SHUTDOWN;
	list_for_each_entry(sd, &g_dev.v4l2_dev->subdevs, list) {
		if (!(sd->flags & V4L2_SUBDEV_FL_HAS_DEVNODE))
			continue;
		v4l2_subdev_call(sd, core, ioctl, VIDIOC_CAM_CONTROL,
			&cam_ctrl);
	}

	g_dev.open_cnt--;
	v4l2_fh_release(filep);

Loading