Skip to contentSkip to conversation

hwrng: intel - return -ENOMEM when ioremap() fails

PATCH In review Thorsten Blum 2 participants 5 messages Sep 22 – Oct 2

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 hwrng: intel - return -ENOMEM when ioremap() fails

intel_init_hw_struct() incorrectly returns -EBUSY when ioremap() fails. Return -ENOMEM instead.

Fixes 641dd002d207 ("[PATCH] fix Intel RNG detection")
---
 drivers/char/hw_random/intel-rng.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/char/hw_random/intel-rng.c +2 -2
index d24e747203c1..a4dd21a9de98 100644
@@ -318,8 +318,8 @@ PFX "RNG, try using the 'no_fwh_detect' option.\n";
 	}
 
 	intel_rng_hw->mem = ioremap(INTEL_FWH_ADDR, INTEL_FWH_ADDR_LEN);
-	if (intel_rng_hw->mem == NULL)
-		return -EBUSY;
+	if (!intel_rng_hw->mem)
+		return -ENOMEM;
 
 	return 0;
 }
#1 lore raw

PATCH 2/2 hwrng: intel - return -ENOMEM when kmalloc_obj() fails

intel_rng_mod_init() incorrectly returns -ENODEV when kmalloc_obj() fails. Return -ENOMEM instead.

Fixes ee527cd3a20c ("Use stop_machine_run in the Intel RNG driver")
---
 drivers/char/hw_random/intel-rng.c | 1 +
 1 file changed, 1 insertion(+)
drivers/char/hw_random/intel-rng.c +1 -0
index a4dd21a9de98..f7f734881c68 100644
@@ -349,6 +349,7 @@ static int __init intel_rng_mod_init(void)
 	intel_rng_hw = kmalloc_obj(*intel_rng_hw);
 	if (!intel_rng_hw) {
 		pci_dev_put(dev);
+		err = -ENOMEM;
 		goto out;
 	}
 
maintainer
#2 lore raw

Re: [PATCH 2/2] hwrng: intel - return -ENOMEM when kmalloc_obj() fails

Quoted 8 lines · Thorsten Blum

intel_rng_mod_init() incorrectly returns -ENODEV when kmalloc_obj() fails. Return -ENOMEM instead.

Fixes ee527cd3a20c ("Use stop_machine_run in the Intel RNG driver")
---
 drivers/char/hw_random/intel-rng.c | 1 +
 1 file changed, 1 insertion(+)

Patch applied. Thanks.

Signature · 3 lines
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
maintainer
#3 lore raw
In reply to Thorsten Blum
Quoted 4 lines · Thorsten Blum

intel_init_hw_struct() incorrectly returns -EBUSY when ioremap() fails. Return -ENOMEM instead.

Fixes 641dd002d207 ("[PATCH] fix Intel RNG detection")

This commit ID appears to be incorrect (but the subject is correct).

Thanks,

Signature · 3 lines
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
#4 lore raw
Quoted 7 lines · Herbert Xu
Quoted 4 lines · Thorsten Blum

intel_init_hw_struct() incorrectly returns -EBUSY when ioremap() fails. Return -ENOMEM instead.

Fixes 641dd002d207 ("[PATCH] fix Intel RNG detection")

This commit ID appears to be incorrect (but the subject is correct).

The commit ID is from stable, in mainline it is:

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=c24c95a085c6b52c11c2f5afecc38b0ca143cdae

The correct tag is therefore:

Fixes c24c95a085c6 ("[PATCH] fix Intel RNG detection")

Should I submit a v2 or can you apply it like this?

Thanks,
Thorsten