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

Commit 940ca5c1 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "rot: add null checks before calling release API" into dev/msm-4.14-display

parents 12cccbc2 0bb7059c
Loading
Loading
Loading
Loading
+15 −5
Original line number Diff line number Diff line
@@ -964,6 +964,7 @@ struct sde_rotator_ctx *sde_rotator_ctx_open(
			ctx, sde_rotator_queue_init);
		if (IS_ERR_OR_NULL(ctx->fh.m2m_ctx)) {
			ret = PTR_ERR(ctx->fh.m2m_ctx);
			ctx->fh.m2m_ctx = NULL;
			goto error_m2m_init;
		}
	}
@@ -1064,6 +1065,10 @@ struct sde_rotator_ctx *sde_rotator_ctx_open(
error_create_sysfs:
	kobject_put(&ctx->kobj);
error_kobj_init:
	if (ctx->file) {
		v4l2_m2m_ctx_release(ctx->fh.m2m_ctx);
		ctx->fh.m2m_ctx = NULL;
	}
error_m2m_init:
	if (ctx->file) {
		v4l2_fh_del(&ctx->fh);
@@ -1101,11 +1106,13 @@ static int sde_rotator_ctx_release(struct sde_rotator_ctx *ctx,
	if (ctx->file) {
		v4l2_ctrl_handler_free(&ctx->ctrl_handler);
		SDEDEV_DBG(rot_dev->dev, "release streams s:%d\n", session_id);
		if (ctx->fh.m2m_ctx) {
			v4l2_m2m_streamoff(file, ctx->fh.m2m_ctx,
				V4L2_BUF_TYPE_VIDEO_OUTPUT);
			v4l2_m2m_streamoff(file, ctx->fh.m2m_ctx,
				V4L2_BUF_TYPE_VIDEO_CAPTURE);
		}
	}
	mutex_unlock(&rot_dev->lock);
	SDEDEV_DBG(rot_dev->dev, "release submit work s:%d\n", session_id);
	list_for_each_safe(curr, next, &ctx->pending_list) {
@@ -1141,10 +1148,13 @@ static int sde_rotator_ctx_release(struct sde_rotator_ctx *ctx,
	sysfs_remove_group(&ctx->kobj, &sde_rotator_fs_attr_group);
	kobject_put(&ctx->kobj);
	if (ctx->file) {
		if (ctx->fh.m2m_ctx)
			v4l2_m2m_ctx_release(ctx->fh.m2m_ctx);
		if (ctx->fh.vdev) {
			v4l2_fh_del(&ctx->fh);
			v4l2_fh_exit(&ctx->fh);
		}
	}
	kfree(ctx->vbinfo_out);
	kfree(ctx->vbinfo_cap);
	kfree(ctx);