After commit e9afc74629 ("hwrng: geode - Use linux/io.h instead of
asm/io.h") the geode-rng driver uses devres with pci_dev->dev to keep
track of resources, but does not actually register a PCI driver. This
results in the following issues:
1. The driver leaks memory because the driver does not attach to a
device. The driver only uses the PCI device as a reference. devm_*()
functions will release resources on driver detach, which the geode-rng
driver will never do. As a result,
2. The driver cannot be reloaded because there is always a use of the
ioport and region after the first load of the driver.
Revert the changes made by e9afc74629 ("hwrng: geode - Use linux/io.h
instead of asm/io.h").
Cc: <[email protected]>
Signed-off-by: Prarit Bhargava <[email protected]>
Fixes: 6e9b5e7688 ("hwrng: geode - Migrate to managed API")
Cc: Matt Mackall <[email protected]>
Cc: Corentin LABBE <[email protected]>
Cc: PrasannaKumar Muralidharan <[email protected]>
Cc: Wei Yongjun <[email protected]>
Cc: [email protected]
Cc: [email protected]
Signed-off-by: Herbert Xu <[email protected]>
In case of error, the function devm_ioremap() returns NULL pointer
not ERR_PTR(). The IS_ERR() test in the return value check should
be replaced with NULL test.
Fixes: 6e9b5e7688 ("hwrng: geode - Migrate to managed API")
Signed-off-by: Wei Yongjun <[email protected]>
Signed-off-by: Herbert Xu <[email protected]>
Fix checkpatch.pl warning by changing from asm/io.h to linux/io.h. In
the mean time arrange the includes in alphabetical order.
Signed-off-by: PrasannaKumar Muralidharan <[email protected]>
Signed-off-by: Herbert Xu <[email protected]>
Use devm_ioremap and devm_hwrng_register instead of ioremap and
hwrng_register. This removes error handling code. Also moved code around
by removing goto statements. This improves code readability.
Signed-off-by: PrasannaKumar Muralidharan <[email protected]>
Signed-off-by: Herbert Xu <[email protected]>
as pr_* macros are more preffered over printk, so printk replaced with corresponding pr_* macros
Signed-off-by: Sudip Mukherjee <[email protected]>
Signed-off-by: Herbert Xu <[email protected]>
Handle waiting for new random within the drivers themselves, this allows to
use better suited timeouts for the individual rngs.
Signed-off-by: Patrick McHardy <[email protected]>
Acked-by: Michael Buesch <[email protected]>
Signed-off-by: Herbert Xu <[email protected]>
The geode hwrng leaks an iomapped resource, if hwrng_register() fails.
This fixes it.
Signed-off-by: Michael Buesch <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>