Skip to content

Commit 3409399

Browse files
ldtsherbertx
authored andcommitted
hwrng: optee - handle unlimited data rates
Data rates of MAX_UINT32 will schedule an unnecessary one jiffy timeout on the call to msleep. Avoid this scenario by using 0 as the unlimited data rate. Signed-off-by: Jorge Ramirez-Ortiz <jorge@foundries.io> Reviewed-by: Sumit Garg <sumit.garg@linaro.org> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
1 parent 3a95887 commit 3409399

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎drivers/char/hw_random/optee-rng.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ static int optee_rng_read(struct hwrng *rng, void *buf, size_t max, bool wait)
128128
data += rng_size;
129129
read += rng_size;
130130

131-
if (wait) {
131+
if (wait && pvt_data->data_rate) {
132132
if (timeout-- == 0)
133133
return read;
134134
msleep((1000 * (max - read)) / pvt_data->data_rate);

0 commit comments

Comments
 (0)