Skip to contentSkip to conversation

Patch "hwrng: omap - write registers after enabling the clock" has been added to the 4.10-stable tree

PATCH [email protected] 1 participant 1 message Mar 24, 2017

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

hwrng: omap - write registers after enabling the clock

to the 4.10-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
hwrng-omap-write-registers-after-enabling-the-clock.patch
and it can be found in the queue-4.10 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From 45c2fdde01299b02a6e3225e848598a3c1e55539 Mon Sep 17 00:00:00 2001

From: Thomas Petazzoni <[email protected]>
Date: Tue, 7 Mar 2017 15:14:46 +0100
Subject: hwrng: omap - write registers after enabling the clock

From: Thomas Petazzoni <[email protected]>

commit 45c2fdde01299b02a6e3225e848598a3c1e55539 upstream.

Commit 383212425c926 ("hwrng: omap - Add device variant for SafeXcel IP-76 found in Armada 8K") added support for the SafeXcel IP-76 variant of the IP. This modification included getting a reference and enabling a clock. Unfortunately, this was done *after* writing to the RNG_INTMASK_REG register. This generally works fine when the driver is built-in because the clock might have been left enabled by the bootloader, but fails short when the driver is built as a module: it causes a system hang because a register is being accessed while the clock is not enabled.

This commit fixes that by making the register access *after* enabling the clock.

This issue was found by the kernelci.org testing effort.

Fixes 383212425c926 ("hwrng: omap - Add device variant for SafeXcel IP-76 found in Armada 8K")
---
 drivers/char/hw_random/omap-rng.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/char/hw_random/omap-rng.c +2 -1
@@ -397,7 +397,6 @@ static int of_get_omap_rng_device_detail
 				irq, err);
 			return err;
 		}
-		omap_rng_write(priv, RNG_INTMASK_REG, RNG_SHUTDOWN_OFLO_MASK);
 
 		priv->clk = of_clk_get(pdev->dev.of_node, 0);
 		if (IS_ERR(priv->clk) && PTR_ERR(priv->clk) == -EPROBE_DEFER)
@@ -408,6 +407,8 @@ static int of_get_omap_rng_device_detail
 				dev_err(&pdev->dev, "unable to enable the clk, "
 						    "err = %d\n", err);
 		}
+
+		omap_rng_write(priv, RNG_INTMASK_REG, RNG_SHUTDOWN_OFLO_MASK);
 	}
 	return 0;
 }

Patches currently in stable-queue which might be from [email protected] are

queue-4.10/hwrng-omap-use-devm_clk_get-instead-of-of_clk_get.patch queue-4.10/hwrng-omap-do-not-access-intmask_reg-on-eip76.patch queue-4.10/hwrng-omap-write-registers-after-enabling-the-clock.patch