]> git.baikalelectronics.ru Git - kernel.git/commit
hwrng: core - Allocate memory during module init
authorPrasannaKumar Muralidharan <prasannatsmkumar@gmail.com>
Wed, 7 Sep 2016 14:48:02 +0000 (20:18 +0530)
committerHerbert Xu <herbert@gondor.apana.org.au>
Tue, 13 Sep 2016 12:27:22 +0000 (20:27 +0800)
commite5e20c19c385afd9ec715e50f9e8ae58dc04447b
tree09dd4e1bf5d30a103e9eaa905cae7b6fe3631291
parentba4b72b8d01e10d19a6d4ba990202be9a979527a
hwrng: core - Allocate memory during module init

In core rng_buffer and rng_fillbuf is allocated in hwrng_register only
once and it is freed during module exit. This patch moves allocating
rng_buffer and rng_fillbuf from hwrng_register to rng core's init. This
avoids checking whether rng_buffer and rng_fillbuf was allocated from
every hwrng_register call. Also moving them to module init makes it
explicit that it is freed in module exit.

Change in v2:
Fix memory leak when register_miscdev fails.

Signed-off-by: PrasannaKumar Muralidharan <prasannatsmkumar@gmail.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/char/hw_random/core.c