summaryrefslogtreecommitdiff
path: root/drivers/char
diff options
context:
space:
mode:
authorYueHaibing <yuehaibing@huawei.com>2019-02-19 14:33:02 +0800
committerArnd Bergmann <arnd@arndb.de>2019-02-20 17:56:27 +0100
commit8deed847445a8fb619689988a24c0f8df1369a58 (patch)
tree6f7c2859b0363e3a0a6827bac2657a9c8dda8227 /drivers/char
parentbb342f016862a0d5b013c2a9dce0f91412b0be77 (diff)
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: 5fe8b1cc6a03 ("hwrng: add OP-TEE based rng driver") Signed-off-by: YueHaibing <yuehaibing@huawei.com> Reviewed-by: Sumit Garg <sumit.garg@linaro.org> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Diffstat (limited to 'drivers/char')
-rw-r--r--drivers/char/hw_random/optee-rng.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/char/hw_random/optee-rng.c b/drivers/char/hw_random/optee-rng.c
index 46f4bcd28c41..d3581ce85cb3 100644
--- a/drivers/char/hw_random/optee-rng.c
+++ b/drivers/char/hw_random/optee-rng.c
@@ -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];