From: Ilpo Järvinen <ilpo.jarvinen@xxxxxxxxxxxxxxx> commit 14cba6ace79627a57fb9058582b03f0ed3832390 upstream. amd_rng_mod_init() uses pci_read_config_dword() that returns PCIBIOS_* codes. The return code is then returned as is but amd_rng_mod_init() is a module_init() function that should return normal errnos. Convert PCIBIOS_* returns code using pcibios_err_to_errno() into normal errno before returning it. Fixes: 96d63c0297cc ("[PATCH] Add AMD HW RNG driver") Cc: stable@xxxxxxxxxxxxxxx Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@xxxxxxxxxxxxxxx> Signed-off-by: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/char/hw_random/amd-rng.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/drivers/char/hw_random/amd-rng.c +++ b/drivers/char/hw_random/amd-rng.c @@ -142,8 +142,10 @@ static int __init mod_init(void) found: err = pci_read_config_dword(pdev, 0x58, &pmbase); - if (err) + if (err) { + err = pcibios_err_to_errno(err); goto put_dev; + } pmbase &= 0x0000FF00; if (pmbase == 0) { Patches currently in stable-queue which might be from ilpo.jarvinen@xxxxxxxxxxxxxxx are queue-4.19/pci-fix-resource-double-counting-on-remove-rescan.patch queue-4.19/x86-of-return-consistent-error-type-from-x86_of_pci_.patch queue-4.19/x86-platform-iosf_mbi-convert-pcibios_-return-codes-.patch queue-4.19/leds-ss4200-convert-pcibios_-return-codes-to-errnos.patch queue-4.19/x86-pci-intel_mid_pci-fix-pcibios_-return-code-handl.patch queue-4.19/hwrng-amd-convert-pcibios_-return-codes-to-errnos.patch queue-4.19/x86-pci-xen-fix-pcibios_-return-code-handling.patch