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

Commit 012f8cc4 authored by Jyoti Wadhwani's avatar Jyoti Wadhwani
Browse files

HDCP2.2 HLOS module: state changes



This patch checks for the correct state
of HDCP2.2 library module before calling
the APIs

Change-Id: I50be91b1a6c14e0241e6fa3e152adf9f67a823e9
Signed-off-by: default avatarJyoti Wadhwani <jyotiw@codeaurora.org>
parent 2066a264
Loading
Loading
Loading
Loading
+4 −14
Original line number Diff line number Diff line
@@ -702,15 +702,6 @@ int hdcp_library_deinit(void *phdcpcontext)
		goto unlock;
	}

	/* this API cannot be called before deinitializing the txmtr */
	if ((hdcp_mod.hdcp_state != HDCP_STATE_TXMTR_DEINIT) &&
			(hdcp_mod.hdcp_state != HDCP_STATE_INIT)) {
		pr_err("%s: invalid state; cur state is %s\n",
			__func__, HDCP_STATE_NAME);
		rc = -EINVAL;
		goto unlock;
	}

	handle = (struct hdcp_client_handle *)phdcpcontext;
	/* deallocate resources */
	complete(&handle->done);
@@ -748,10 +739,9 @@ int hdcp_library_deinit(void *phdcpcontext)
		}

		pr_debug("%s: unloading secure app success\n", __func__);

		hdcp_mod.hdcp_state = HDCP_STATE_DEINIT;
	}
	hdcp_mod.ref_cnt--;
	hdcp_mod.hdcp_state = HDCP_STATE_DEINIT;

	kzfree(handle);
	handle = NULL;
@@ -790,7 +780,7 @@ static int hdcp2p2_txmtr_init(void *phdcpcontext)
	}

	/* library should be initialized before calling this API */
	if (hdcp_mod.hdcp_state != HDCP_STATE_INIT) {
	if (hdcp_mod.hdcp_state == HDCP_STATE_DEINIT) {
		pr_err("%s: invalid state of hdcp library: %s\n",
				__func__, HDCP_STATE_NAME);
		rc = -EINVAL;
@@ -912,8 +902,8 @@ static int hdcp2p2_txmtr_process_message(void *phdcpcontext,
		return -EINVAL;
	}
	mutex_lock(&hdcp_mod.hdcp_lock);
	/* If txmtr is not yet initialized then return error */
	if (hdcp_mod.hdcp_state != HDCP_STATE_TXMTR_INIT) {
	/* If library is not yet initialized then return error */
	if (hdcp_mod.hdcp_state == HDCP_STATE_DEINIT) {
		pr_err("%s: invalid state of hdcp library: %s\n",
				__func__, HDCP_STATE_NAME);
		rc = -EINVAL;