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

Commit 8deed847 authored by YueHaibing's avatar YueHaibing Committed by Arnd Bergmann
Browse files

hwrng: Fix unsigned comparison with less than zero



The return from the call to tee_client_invoke_func can be a
negative error code however this is being assigned to an
unsigned variable 'ret' hence the check is always false.
Fix this by making 'ret' an int.

Detected by Coccinelle ("Unsigned expression compared with zero:
ret < 0")

Fixes: 5fe8b1cc ("hwrng: add OP-TEE based rng driver")
Signed-off-by: default avatarYueHaibing <yuehaibing@huawei.com>
Reviewed-by: default avatarSumit Garg <sumit.garg@linaro.org>
Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
parent bb342f01
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -73,7 +73,7 @@ struct optee_rng_private {
static size_t get_optee_rng_data(struct optee_rng_private *pvt_data,
				 void *buf, size_t req_size)
{
	u32 ret = 0;
	int ret = 0;
	u8 *rng_data = NULL;
	size_t rng_size = 0;
	struct tee_ioctl_invoke_arg inv_arg;
@@ -175,7 +175,7 @@ static struct optee_rng_private pvt_data = {

static int get_optee_rng_info(struct device *dev)
{
	u32 ret = 0;
	int ret = 0;
	struct tee_ioctl_invoke_arg inv_arg;
	struct tee_param param[4];