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

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

Merge "security: pfe: Return proper error code"

parents e0a84ace 39e001a1
Loading
Loading
Loading
Loading
+19 −12
Original line number Diff line number Diff line
@@ -71,6 +71,7 @@ int qti_pfk_ice_set_key(uint32_t index, uint8_t *key, uint8_t *salt,
	int ret;
	char *tzbuf_key = (char *)ice_key;
	char *tzbuf_salt = (char *)ice_salt;
	char *s_type = storage_type;

	uint32_t smc_id = 0;
	u32 tzbuflen_key = sizeof(ice_key);
@@ -107,27 +108,31 @@ int qti_pfk_ice_set_key(uint32_t index, uint8_t *key, uint8_t *salt,
	desc.args[3] = virt_to_phys(tzbuf_salt);
	desc.args[4] = tzbuflen_salt;

	ret = qcom_ice_setup_ice_hw((const char *)storage_type, true);
	ret = qcom_ice_setup_ice_hw((const char *)s_type, true);

	if (ret) {
		pr_err("%s: could not enable clocks: 0x%x\n", __func__, ret);
		return ret;
		goto out;
	}

	ret = scm_call2(smc_id, &desc);

	ret = qcom_ice_setup_ice_hw((const char *)storage_type, false);

	pr_debug(" %s , ret = %d\n", __func__, ret);

	if (ret) {
		pr_err("%s: Error: 0x%x\n", __func__, ret);

		if (ret == -EBUSY) {
			goto out;
		} else {
			smc_id = TZ_ES_INVALIDATE_ICE_KEY_ID;
			desc.arginfo = TZ_ES_INVALIDATE_ICE_KEY_PARAM_ID;
			desc.args[0] = index;
			scm_call2(smc_id, &desc);
		}
	}

	ret = qcom_ice_setup_ice_hw((const char *)s_type, false);
out:
	return ret;
}

@@ -160,11 +165,13 @@ int qti_pfk_ice_invalidate_key(uint32_t index, char *storage_type)

	ret = scm_call2(smc_id, &desc);

	ret = qcom_ice_setup_ice_hw((const char *)storage_type, false);

	pr_debug(" %s , ret = %d\n", __func__, ret);
	if (ret)
	if (ret) {
		pr_err("%s: Error: 0x%x\n", __func__, ret);
		qcom_ice_setup_ice_hw((const char *)storage_type, false);
	} else {
		ret = qcom_ice_setup_ice_hw((const char *)storage_type, false);
	}

	return ret;