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

Commit a2708487 authored by Suraj Dongre's avatar Suraj Dongre
Browse files

msm: camera: Fix context refcount underflow



Fixed context refcount underflow caused by putref even though device
handle had been already released.
Also fixed check for dev handle value.

Change-Id: I50b9d77571381dd308f30059104be416caea6885
Signed-off-by: default avatarSuraj Dongre <sdongre@codeaurora.org>
parent 57dad9f1
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -58,7 +58,7 @@ int cam_context_shutdown(struct cam_context *ctx)
	}

	if (!rc)
		cam_destroy_device_hdl(ctx_hdl);
		rc = cam_destroy_device_hdl(ctx_hdl);
	return rc;
}

+1 −0
Original line number Diff line number Diff line
@@ -490,6 +490,7 @@ int32_t cam_context_acquire_dev_to_hw(struct cam_context *ctx,
	release.ctxt_to_hw_map = ctx->ctxt_to_hw_map;
	ctx->hw_mgr_intf->hw_release(ctx->hw_mgr_intf->hw_mgr_priv, &release);
	ctx->ctxt_to_hw_map = NULL;
	ctx->dev_hdl = -1;
end:
	return rc;
}
+5 −2
Original line number Diff line number Diff line
@@ -413,13 +413,16 @@ int cam_node_deinit(struct cam_node *node)
int cam_node_shutdown(struct cam_node *node)
{
	int i = 0;
	int rc = 0;

	if (!node)
		return -EINVAL;

	for (i = 0; i < node->ctx_size; i++) {
		if (node->ctx_list[i].dev_hdl >= 0) {
			cam_context_shutdown(&(node->ctx_list[i]));
		if (node->ctx_list[i].dev_hdl > 0) {
			rc = cam_context_shutdown(&(node->ctx_list[i]));
			if (rc)
				continue;
			cam_context_putref(&(node->ctx_list[i]));
		}
	}