mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/1] hwrng: amd - Convert PCIBIOS_* return codes to errnos
@ 2024-05-27 13:26 Ilpo Järvinen
  2024-06-07 11:52 ` Herbert Xu
  0 siblings, 1 reply; 2+ messages in thread
From: Ilpo Järvinen @ 2024-05-27 13:26 UTC (permalink / raw)
  To: Olivia Mackall, Herbert Xu, Michael Buesch, Andrew Morton,
	linux-crypto, linux-kernel
  Cc: Ilpo Järvinen, stable

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>
---
 drivers/char/hw_random/amd-rng.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/char/hw_random/amd-rng.c b/drivers/char/hw_random/amd-rng.c
index 86162a13681e..9a24d19236dc 100644
--- a/drivers/char/hw_random/amd-rng.c
+++ b/drivers/char/hw_random/amd-rng.c
@@ -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) {
-- 
2.39.2


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH 1/1] hwrng: amd - Convert PCIBIOS_* return codes to errnos
  2024-05-27 13:26 [PATCH 1/1] hwrng: amd - Convert PCIBIOS_* return codes to errnos Ilpo Järvinen
@ 2024-06-07 11:52 ` Herbert Xu
  0 siblings, 0 replies; 2+ messages in thread
From: Herbert Xu @ 2024-06-07 11:52 UTC (permalink / raw)
  To: Ilpo Järvinen
  Cc: Olivia Mackall, Michael Buesch, Andrew Morton, linux-crypto,
	linux-kernel, stable

On Mon, May 27, 2024 at 04:26:15PM +0300, Ilpo Järvinen wrote:
> 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>
> ---
>  drivers/char/hw_random/amd-rng.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)

Patch applied.  Thanks.
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-06-07 11:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-27 13:26 [PATCH 1/1] hwrng: amd - Convert PCIBIOS_* return codes to errnos Ilpo Järvinen
2024-06-07 11:52 ` Herbert Xu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®