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

* Re: [PATCH] clk: at91: check pmc node status before registering syscore ops
  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
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Nicolas Ferre @ 2021-09-13 10:06 UTC (permalink / raw)
  To: Clément Léger, Michael Turquette, Stephen Boyd,
	Alexandre Belloni, Ludovic Desroches
  Cc: linux-clk, linux-arm-kernel, linux-kernel

On 13/09/2021 at 10:26, Clément Léger wrote:
> 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>

Yes, indeed,
Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com>

Thanks, best regards,
   Nicolas

> ---
>   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
> 


-- 
Nicolas Ferre

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

* Re: [PATCH] clk: at91: check pmc node status before registering syscore ops
  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-10-08  3:48 ` Stephen Boyd
  3 siblings, 0 replies; 6+ messages in thread
From: Claudiu.Beznea @ 2021-09-13 13:38 UTC (permalink / raw)
  To: clement.leger, mturquette, sboyd, Nicolas.Ferre,
	alexandre.belloni, Ludovic.Desroches
  Cc: linux-clk, linux-arm-kernel, linux-kernel

On 13.09.2021 11:26, Clément Léger wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> 
> 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>

Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.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	[flat|nested] 6+ messages in thread

* Re: [PATCH] clk: at91: check pmc node status before registering syscore ops
  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
  3 siblings, 1 reply; 6+ messages in thread
From: Stephen Boyd @ 2021-09-14 22:03 UTC (permalink / raw)
  To: Alexandre Belloni, Clement Leger, Ludovic Desroches,
	Michael Turquette, Nicolas Ferre
  Cc: linux-clk, linux-arm-kernel, linux-kernel, Clement Leger

Quoting Clement Leger (2021-09-13 01:26:33)
> 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: Clement Leger <clement.leger@bootlin.com>

Any Fixes tag?

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

* Re: [PATCH] clk: at91: check pmc node status before registering syscore ops
  2021-09-14 22:03 ` Stephen Boyd
@ 2021-09-15  6:15   ` Clément Léger
  0 siblings, 0 replies; 6+ messages in thread
From: Clément Léger @ 2021-09-15  6:15 UTC (permalink / raw)
  To: Stephen Boyd
  Cc: Alexandre Belloni, Ludovic Desroches, Michael Turquette,
	Nicolas Ferre, linux-clk, linux-arm-kernel, linux-kernel

Le Tue, 14 Sep 2021 15:03:01 -0700,
Stephen Boyd <sboyd@kernel.org> a écrit :

> Quoting Clement Leger (2021-09-13 01:26:33)
> > 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: Clement Leger <clement.leger@bootlin.com>  
> 
> Any Fixes tag?

Since this was present from the start of the implementation, I think it
should be the following:

Fixes: b3b02eac33ed ("clk: at91: Add sama5d2 suspend/resume")

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

* Re: [PATCH] clk: at91: check pmc node status before registering syscore ops
  2021-09-13  8:26 [PATCH] clk: at91: check pmc node status before registering syscore ops Clément Léger
                   ` (2 preceding siblings ...)
  2021-09-14 22:03 ` Stephen Boyd
@ 2021-10-08  3:48 ` Stephen Boyd
  3 siblings, 0 replies; 6+ messages in thread
From: Stephen Boyd @ 2021-10-08  3:48 UTC (permalink / raw)
  To: Alexandre Belloni, Clément Léger, Ludovic Desroches,
	Michael Turquette, Nicolas Ferre
  Cc: linux-clk, linux-arm-kernel, linux-kernel, Clément Léger

Quoting Clément Léger (2021-09-13 01:26:33)
> 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>
> ---

Applied to clk-next

^ permalink raw reply	[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).