]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
hwrng: amd - Convert PCIBIOS_* return codes to errnos
authorIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
Mon, 27 May 2024 13:26:15 +0000 (16:26 +0300)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 7 Jun 2024 11:46:38 +0000 (19:46 +0800)
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@vger.kernel.org
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/char/hw_random/amd-rng.c

index 86162a13681e67e81595275074cdd36138d15234..9a24d19236dc700a8ab2d48b639176b2483d593b 100644 (file)
@@ -143,8 +143,10 @@ static int __init amd_rng_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) {