[4.19,034/422] tee: optee: take DT status property into account

Message ID 20191119051402.211777274@linuxfoundation.org
State New
Headers show
Series
  • Untitled series #25072
Related show

Commit Message

Greg KH Nov. 19, 2019, 5:13 a.m.
From: Ard Biesheuvel <ard.biesheuvel@linaro.org>


[ 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 <ard.biesheuvel@linaro.org>

Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>

Signed-off-by: Sasha Levin <sashal@kernel.org>

---
 drivers/tee/optee/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
2.20.1

Comments

Nobuhiro Iwamatsu Nov. 20, 2019, 2:18 a.m. | #1
Hi,

On Tue, Nov 19, 2019 at 06:13:51AM +0100, Greg Kroah-Hartman wrote:
> From: Ard Biesheuvel <ard.biesheuvel@linaro.org>

> 

> [ 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 <ard.biesheuvel@linaro.org>

> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>

> Signed-off-by: Sasha Levin <sashal@kernel.org>


This patch requires the following additional commit:

commit c7c0d8df0b94a67377555a550b8d66ee2ad2f4ed
Author: Julia Lawall <Julia.Lawall@lip6.fr>
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 <Julia.Lawall@lip6.fr>

    Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>


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

Best regards,
  Nobuhiro
Greg KH Nov. 21, 2019, 6:54 a.m. | #2
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 <ard.biesheuvel@linaro.org>

> > 

> > [ 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 <ard.biesheuvel@linaro.org>

> > Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>

> > Signed-off-by: Sasha Levin <sashal@kernel.org>

> 

> This patch requires the following additional commit:

> 

> commit c7c0d8df0b94a67377555a550b8d66ee2ad2f4ed

> Author: Julia Lawall <Julia.Lawall@lip6.fr>

> 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 <Julia.Lawall@lip6.fr>

>     Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>

> 

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


Now queued up, thanks!

greg k-h

Patch

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