2019-11-19 05:27:12

by Greg Kroah-Hartman

[permalink] [raw]
Subject: [PATCH 4.19 034/422] tee: optee: take DT status property into account

From: Ard Biesheuvel <[email protected]>

[ Upstream commit db878f76b9ff7487da9bb0f686153f81829f1230 ]

DT nodes may have a 'status' property which, if set to anything other
than 'ok' or 'okay', indicates to the OS that the DT node should be
treated as if it was not present. So add that missing logic to the
OP-TEE driver.

Signed-off-by: Ard Biesheuvel <[email protected]>
Signed-off-by: Jens Wiklander <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
---
drivers/tee/optee/core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/tee/optee/core.c b/drivers/tee/optee/core.c
index e1aafe842d660..34dce850067b9 100644
--- a/drivers/tee/optee/core.c
+++ b/drivers/tee/optee/core.c
@@ -696,7 +696,7 @@ static int __init optee_driver_init(void)
return -ENODEV;

np = of_find_matching_node(fw_np, optee_match);
- if (!np)
+ if (!np || !of_device_is_available(np))
return -ENODEV;

optee = optee_probe(np);
--
2.20.1




2019-11-20 02:20:17

by Nobuhiro Iwamatsu

[permalink] [raw]
Subject: Re: [PATCH 4.19 034/422] tee: optee: take DT status property into account

Hi,

On Tue, Nov 19, 2019 at 06:13:51AM +0100, Greg Kroah-Hartman wrote:
> From: Ard Biesheuvel <[email protected]>
>
> [ Upstream commit db878f76b9ff7487da9bb0f686153f81829f1230 ]
>
> DT nodes may have a 'status' property which, if set to anything other
> than 'ok' or 'okay', indicates to the OS that the DT node should be
> treated as if it was not present. So add that missing logic to the
> OP-TEE driver.
>
> Signed-off-by: Ard Biesheuvel <[email protected]>
> Signed-off-by: Jens Wiklander <[email protected]>
> Signed-off-by: Sasha Levin <[email protected]>

This patch requires the following additional commit:

commit c7c0d8df0b94a67377555a550b8d66ee2ad2f4ed
Author: Julia Lawall <[email protected]>
Date: Sat Feb 23 14:20:36 2019 +0100

tee: optee: add missing of_node_put after of_device_is_available

Add an of_node_put when a tested device node is not available.

The semantic patch that fixes this problem is as follows
(http://coccinelle.lip6.fr):

// <smpl>
@@
identifier f;
local idexpression e;
expression x;
@@

e = f(...);
... when != of_node_put(e)
when != x = e
when != e = x
when any
if (<+...of_device_is_available(e)...+>) {
... when != of_node_put(e)
(
return e;
|
+ of_node_put(e);
return ...;
)
}
// </smpl>

Fixes: db878f76b9ff ("tee: optee: take DT status property into account")
Signed-off-by: Julia Lawall <[email protected]>
Signed-off-by: Jens Wiklander <[email protected]>

Please apply this commit. And this is also required for 4.14.y.

Best regards,
Nobuhiro

2019-11-21 06:56:20

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH 4.19 034/422] tee: optee: take DT status property into account

On Wed, Nov 20, 2019 at 11:18:28AM +0900, Nobuhiro Iwamatsu wrote:
> Hi,
>
> On Tue, Nov 19, 2019 at 06:13:51AM +0100, Greg Kroah-Hartman wrote:
> > From: Ard Biesheuvel <[email protected]>
> >
> > [ Upstream commit db878f76b9ff7487da9bb0f686153f81829f1230 ]
> >
> > DT nodes may have a 'status' property which, if set to anything other
> > than 'ok' or 'okay', indicates to the OS that the DT node should be
> > treated as if it was not present. So add that missing logic to the
> > OP-TEE driver.
> >
> > Signed-off-by: Ard Biesheuvel <[email protected]>
> > Signed-off-by: Jens Wiklander <[email protected]>
> > Signed-off-by: Sasha Levin <[email protected]>
>
> This patch requires the following additional commit:
>
> commit c7c0d8df0b94a67377555a550b8d66ee2ad2f4ed
> Author: Julia Lawall <[email protected]>
> Date: Sat Feb 23 14:20:36 2019 +0100
>
> tee: optee: add missing of_node_put after of_device_is_available
>
> Add an of_node_put when a tested device node is not available.
>
> The semantic patch that fixes this problem is as follows
> (http://coccinelle.lip6.fr):
>
> // <smpl>
> @@
> identifier f;
> local idexpression e;
> expression x;
> @@
>
> e = f(...);
> ... when != of_node_put(e)
> when != x = e
> when != e = x
> when any
> if (<+...of_device_is_available(e)...+>) {
> ... when != of_node_put(e)
> (
> return e;
> |
> + of_node_put(e);
> return ...;
> )
> }
> // </smpl>
>
> Fixes: db878f76b9ff ("tee: optee: take DT status property into account")
> Signed-off-by: Julia Lawall <[email protected]>
> Signed-off-by: Jens Wiklander <[email protected]>
>
> Please apply this commit. And this is also required for 4.14.y.

Now queued up, thanks!

greg k-h