From: PrasannaKumar Muralidharan Date: Fri, 26 Aug 2016 18:32:04 +0000 (+0530) Subject: hwrng: Remove check for max less than 4 bytes X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=68734bc9f58ee01f1b530394cc31d58e364125f6;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git hwrng: Remove check for max less than 4 bytes HW RNG core never asks for data less than 4 bytes. The check whether max is less than 4 bytes is unnecessary. Remove the check. Signed-off-by: PrasannaKumar Muralidharan Signed-off-by: Herbert Xu --- diff --git a/drivers/char/hw_random/meson-rng.c b/drivers/char/hw_random/meson-rng.c index 0cfd81bcaeac..58bef39f7286 100644 --- a/drivers/char/hw_random/meson-rng.c +++ b/drivers/char/hw_random/meson-rng.c @@ -76,9 +76,6 @@ static int meson_rng_read(struct hwrng *rng, void *buf, size_t max, bool wait) struct meson_rng_data *data = container_of(rng, struct meson_rng_data, rng); - if (max < sizeof(u32)) - return 0; - *(u32 *)buf = readl_relaxed(data->base + RNG_DATA); return sizeof(u32); diff --git a/drivers/char/hw_random/st-rng.c b/drivers/char/hw_random/st-rng.c index 1d35363d23c5..7e8aa6b7b452 100644 --- a/drivers/char/hw_random/st-rng.c +++ b/drivers/char/hw_random/st-rng.c @@ -54,9 +54,6 @@ static int st_rng_read(struct hwrng *rng, void *data, size_t max, bool wait) u32 status; int i; - if (max < sizeof(u16)) - return -EINVAL; - /* Wait until FIFO is full - max 4uS*/ for (i = 0; i < ST_RNG_FILL_FIFO_TIMEOUT; i++) { status = readl_relaxed(ddata->base + ST_RNG_STATUS_REG);