Skip to contentSkip to conversation

hw_random: timeriomem-rng: Remove 'max < 4' condition check

PATCH In review PrasannaKumar Muralidharan 2 participants 3 messages Aug 22, 2017 – Aug 23, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hw_random: timeriomem-rng: Remove 'max < 4' condition check

In read routiene max is always >= 4. The check whether 'max < 4' is not necessary. Remove it.

---
 drivers/char/hw_random/timeriomem-rng.c | 7 -------
 1 file changed, 7 deletions(-)
drivers/char/hw_random/timeriomem-rng.c +0 -7
index 03ff548..f615684 100644
@@ -53,13 +53,6 @@ static int timeriomem_rng_read(struct hwrng *hwrng, void *data,
 	int period_us = ktime_to_us(priv->period);
 
 	/*
-	 * The RNG provides 32-bits per read.  Ensure there is enough space for
-	 * at minimum one read.
-	 */
-	if (max < sizeof(u32))
-		return 0;
-
-	/*
 	 * There may not have been enough time for new data to be generated
 	 * since the last request.  If the caller doesn't want to wait, let them
 	 * bail out.  Otherwise, wait for the completion.  If the new data has
Signature · 1 line
2.10.0
Acked-by on v1 1/1
#1 lore raw
Quoted 3 lines · PrasannaKumar Muralidharan

In read routiene max is always >= 4. The check whether 'max < 4' is not necessary. Remove it.

Missed that in the header.

Quoted 27 lines
---
 drivers/char/hw_random/timeriomem-rng.c | 7 -------
 1 file changed, 7 deletions(-)
drivers/char/hw_random/timeriomem-rng.c +0 -8
index 03ff548..f615684 100644
@@ -53,13 +53,6 @@ static int timeriomem_rng_read(struct hwrng *hwrng, void *data,
        int period_us = ktime_to_us(priv->period);
 
        /*
-        * The RNG provides 32-bits per read.  Ensure there is enough space for
-        * at minimum one read.
-        */
-       if (max < sizeof(u32))
-               return 0;
-
-       /*
         * There may not have been enough time for new data to be generated
         * since the last request.  If the caller doesn't want to wait, let them
         * bail out.  Otherwise, wait for the completion.  If the new data has
--

2.10.0

#2 lore raw

Hi Rick,

Quoted 7 lines · Rick Altherr
Quoted 3 lines · PrasannaKumar Muralidharan

In read routiene max is always >= 4. The check whether 'max < 4' is not necessary. Remove it.

Missed that in the header.

It was added recently so you could have not missed it.

Quoted 16 lines
Quoted 13 lines
---
 drivers/char/hw_random/timeriomem-rng.c | 7 -------
 1 file changed, 7 deletions(-)
drivers/char/hw_random/timeriomem-rng.c +0 -0
index 03ff548..f615684 100644
@@ -53,13 +53,6 @@ static int timeriomem_rng_read(struct hwrng *hwrng, void *data,
        int period_us = ktime_to_us(priv->period);
 
Quoted 14 lines
Quoted 12 lines
drivers/char/hw_random/timeriomem-rng.c +0 -8
        /*
-        * The RNG provides 32-bits per read.  Ensure there is enough space for
-        * at minimum one read.
-        */
-       if (max < sizeof(u32))
-               return 0;
-
-       /*
         * There may not have been enough time for new data to be generated
         * since the last request.  If the caller doesn't want to wait, let them
         * bail out.  Otherwise, wait for the completion.  If the new data has
--
Quoted 2 lines

2.10.0

Regards,
PrasannaKumar