/*
  * crng_fast_load() can be called by code in the interrupt service
- * path.  So we can't afford to dilly-dally.
+ * path.  So we can't afford to dilly-dally. Returns the number of
+ * bytes processed from cp.
  */
-static int crng_fast_load(const char *cp, size_t len)
+static size_t crng_fast_load(const char *cp, size_t len)
 {
        unsigned long flags;
        char *p;
+       size_t ret = 0;
 
        if (!spin_trylock_irqsave(&primary_crng.lock, flags))
                return 0;
        p = (unsigned char *) &primary_crng.state[4];
        while (len > 0 && crng_init_cnt < CRNG_INIT_CNT_THRESH) {
                p[crng_init_cnt % CHACHA_KEY_SIZE] ^= *cp;
-               cp++; crng_init_cnt++; len--;
+               cp++; crng_init_cnt++; len--; ret++;
        }
        spin_unlock_irqrestore(&primary_crng.lock, flags);
        if (crng_init_cnt >= CRNG_INIT_CNT_THRESH) {
                crng_init = 1;
                pr_notice("fast init done\n");
        }
-       return 1;
+       return ret;
 }
 
 /*
        if (unlikely(crng_init == 0)) {
                if ((fast_pool->count >= 64) &&
                    crng_fast_load((char *) fast_pool->pool,
-                                  sizeof(fast_pool->pool))) {
+                                  sizeof(fast_pool->pool)) > 0) {
                        fast_pool->count = 0;
                        fast_pool->last = now;
                }
        struct entropy_store *poolp = &input_pool;
 
        if (unlikely(crng_init == 0)) {
-               crng_fast_load(buffer, count);
-               return;
+               size_t ret = crng_fast_load(buffer, count);
+               count -= ret;
+               buffer += ret;
+               if (!count || crng_init == 0)
+                       return;
        }
 
        /* Suspend writing if we're above the trickle threshold.