hwrng: amd - release_region must be called after hwrng_unregister
authorCorentin LABBE <clabbe.montjoie@gmail.com>
Fri, 26 Aug 2016 11:11:33 +0000 (13:11 +0200)
committerHerbert Xu <herbert@gondor.apana.org.au>
Wed, 31 Aug 2016 15:00:45 +0000 (23:00 +0800)
The driver release the memory region before being sure that nobody use
it.

This patch made hwrng_unregister ran before any release was done.

Signed-off-by: LABBE Corentin <clabbe.montjoie@gmail.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/char/hw_random/amd-rng.c

index de82fe3643a51f94c10bdde343d1338268419fb6..383e1974234dac82969d5d3e9903315298c2118c 100644 (file)
@@ -151,8 +151,9 @@ static void __exit mod_exit(void)
 {
        u32 pmbase = (unsigned long)amd_rng.priv;
 
-       release_region(pmbase + 0xF0, 8);
        hwrng_unregister(&amd_rng);
+
+       release_region(pmbase + 0xF0, 8);
 }
 
 module_init(mod_init);