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

Commit bf5a41f8 authored by Olav Haugan's avatar Olav Haugan
Browse files

drivers: soc: qcom: Ensure bytes_received is initialized



Not all code paths initialize bytes_received. Fix this.

Change-Id: I54f069a8de96e9f092237fe2ee47991ff661ef53
Signed-off-by: default avatarOlav Haugan <ohaugan@codeaurora.org>
parent d98d9ee8
Loading
Loading
Loading
Loading
+6 −5
Original line number Diff line number Diff line
@@ -38,6 +38,7 @@ void __init init_random_pool(void)
	int ret;
	u32 resp;
	struct scm_desc desc;
	u64 bytes_received;

	data.out_buf = (uint8_t *) virt_to_phys(random_buffer);
	desc.args[0] = (unsigned long) data.out_buf;
@@ -46,18 +47,18 @@ void __init init_random_pool(void)

	dmac_flush_range(random_buffer, random_buffer + RANDOM_BUFFER_SIZE);

	if (!is_scm_armv8())
	if (!is_scm_armv8()) {
		ret = scm_call_noalloc(TZ_SVC_CRYPTO, PRNG_CMD_ID, &data,
				sizeof(data), &resp, sizeof(resp),
				common_scm_buf,
				SCM_BUFFER_SIZE(common_scm_buf));
	else
		bytes_received = resp;
	} else {
		ret = scm_call2(SCM_SIP_FNID(TZ_SVC_CRYPTO, PRNG_CMD_ID),
					&desc);

		bytes_received = desc.ret[0];
	}
	if (!ret) {
		u64 bytes_received = desc.ret[0];

		if (bytes_received != SZ_512)
			pr_warn("Did not receive the expected number of bytes from PRNG: %llu\n",
				bytes_received);