linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] clk: at91: check pmc node status before registering syscore ops
@ 2021-09-13  8:26 Clément Léger
  2021-09-13 10:06 ` Nicolas Ferre
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Clément Léger @ 2021-09-13  8:26 UTC (permalink / raw)
  To: Michael Turquette, Stephen Boyd, Nicolas Ferre,
	Alexandre Belloni, Ludovic Desroches
  Cc: linux-clk, linux-arm-kernel, linux-kernel, Clément Léger

Currently, at91 pmc driver always register the syscore_ops whatever
the status of the pmc node that has been found. When set as secure
and disabled, the pmc should not be accessed or this will generate
abort exceptions.
To avoid this, add a check on node availability before registering
the syscore operations.

Signed-off-by: Clément Léger <clement.leger@bootlin.com>
---
 drivers/clk/at91/pmc.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/clk/at91/pmc.c b/drivers/clk/at91/pmc.c
index 20ee9dccee78..b40035b011d0 100644
--- a/drivers/clk/at91/pmc.c
+++ b/drivers/clk/at91/pmc.c
@@ -267,6 +267,11 @@ static int __init pmc_register_ops(void)
 	if (!np)
 		return -ENODEV;
 
+	if (!of_device_is_available(np)) {
+		of_node_put(np);
+		return -ENODEV;
+	}
+
 	pmcreg = device_node_to_regmap(np);
 	of_node_put(np);
 	if (IS_ERR(pmcreg))
-- 
2.33.0


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

end of thread, other threads:[~2021-10-08  3:48 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-13  8:26 [PATCH] clk: at91: check pmc node status before registering syscore ops Clément Léger
2021-09-13 10:06 ` Nicolas Ferre
2021-09-13 13:38 ` Claudiu.Beznea
2021-09-14 22:03 ` Stephen Boyd
2021-09-15  6:15   ` Clément Léger
2021-10-08  3:48 ` Stephen Boyd

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).