diff mbox series

tee: optee: Change printing during optee_probe

Message ID 20210310110100.3040439-1-ilias.apalodimas@linaro.org
State Superseded
Headers show
Series tee: optee: Change printing during optee_probe | expand

Commit Message

Ilias Apalodimas March 10, 2021, 11:01 a.m. UTC
Right now the error messages when optee has a version mismatch or shared
memory is not configured are done with a debug().
That's not very convenient since you have to enable debugging to figure
out what's going on, although this is an actual error.

So let's switch the debug() -> log_err() and report those explicitly.

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>

---
 drivers/tee/optee/core.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

-- 
2.30.1

Comments

Patrick Delaunay March 10, 2021, 1:28 p.m. UTC | #1
Hi Ilias

On 3/10/21 12:01 PM, Ilias Apalodimas wrote:
> Right now the error messages when optee has a version mismatch or shared

> memory is not configured are done with a debug().

> That's not very convenient since you have to enable debugging to figure

> out what's going on, although this is an actual error.

>

> So let's switch the debug() -> log_err() and report those explicitly.

>

> Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>

> ---

>   drivers/tee/optee/core.c | 6 +++---

>   1 file changed, 3 insertions(+), 3 deletions(-)

>

> diff --git a/drivers/tee/optee/core.c b/drivers/tee/optee/core.c

> index b898c32edc0b..1b0a7c0c9668 100644

> --- a/drivers/tee/optee/core.c

> +++ b/drivers/tee/optee/core.c

> @@ -624,14 +624,14 @@ static int optee_probe(struct udevice *dev)

>   	u32 sec_caps;

>   

>   	if (!is_optee_api(pdata->invoke_fn)) {

> -		debug("%s: OP-TEE api uid mismatch\n", __func__);

> +		log_err("%s: OP-TEE api uid mismatch\n", __func__);

>   		return -ENOENT;

>   	}

>   

>   	print_os_revision(dev, pdata->invoke_fn);

>   

>   	if (!api_revision_is_compatible(pdata->invoke_fn)) {

> -		debug("%s: OP-TEE api revision mismatch\n", __func__);

> +		log_err("%s: OP-TEE api revision mismatch\n", __func__);

>   		return -ENOENT;

>   	}

>   

> @@ -642,7 +642,7 @@ static int optee_probe(struct udevice *dev)

>   	 */

>   	if (!exchange_capabilities(pdata->invoke_fn, &sec_caps) ||

>   	    !(sec_caps & OPTEE_SMC_SEC_CAP_DYNAMIC_SHM)) {

> -		debug("%s: OP-TEE capabilities mismatch\n", __func__);

> +		log_err("%s: OP-TEE capabilities mismatch\n", __func__);

>   		return -ENOENT;

>   	}

>   



Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>



just 2 minor remark:

1/ why you don't use dev_errĀ  => the device name will be displayed

2/ why __func__ is used here, it is not needed with log macro

proposal:

- log_err("%s: OP-TEE capabilities mismatch\n", __func__);

+ dev_err(dev, "OP-TEE capabilities mismatch\n");


Thanks
Patrick
Ilias Apalodimas March 10, 2021, 1:30 p.m. UTC | #2
On Wed, Mar 10, 2021 at 02:28:20PM +0100, Patrick DELAUNAY wrote:
> Hi Ilias

> 

> On 3/10/21 12:01 PM, Ilias Apalodimas wrote:

> > Right now the error messages when optee has a version mismatch or shared

> > memory is not configured are done with a debug().

> > That's not very convenient since you have to enable debugging to figure

> > out what's going on, although this is an actual error.

> > 

> > So let's switch the debug() -> log_err() and report those explicitly.

> > 

> > Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>

> > ---

> >   drivers/tee/optee/core.c | 6 +++---

> >   1 file changed, 3 insertions(+), 3 deletions(-)

> > 

> > diff --git a/drivers/tee/optee/core.c b/drivers/tee/optee/core.c

> > index b898c32edc0b..1b0a7c0c9668 100644

> > --- a/drivers/tee/optee/core.c

> > +++ b/drivers/tee/optee/core.c

> > @@ -624,14 +624,14 @@ static int optee_probe(struct udevice *dev)

> >   	u32 sec_caps;

> >   	if (!is_optee_api(pdata->invoke_fn)) {

> > -		debug("%s: OP-TEE api uid mismatch\n", __func__);

> > +		log_err("%s: OP-TEE api uid mismatch\n", __func__);

> >   		return -ENOENT;

> >   	}

> >   	print_os_revision(dev, pdata->invoke_fn);

> >   	if (!api_revision_is_compatible(pdata->invoke_fn)) {

> > -		debug("%s: OP-TEE api revision mismatch\n", __func__);

> > +		log_err("%s: OP-TEE api revision mismatch\n", __func__);

> >   		return -ENOENT;

> >   	}

> > @@ -642,7 +642,7 @@ static int optee_probe(struct udevice *dev)

> >   	 */

> >   	if (!exchange_capabilities(pdata->invoke_fn, &sec_caps) ||

> >   	    !(sec_caps & OPTEE_SMC_SEC_CAP_DYNAMIC_SHM)) {

> > -		debug("%s: OP-TEE capabilities mismatch\n", __func__);

> > +		log_err("%s: OP-TEE capabilities mismatch\n", __func__);

> >   		return -ENOENT;

> >   	}

> 

> 

> Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

> 

> 

> just 2 minor remark:

> 

> 1/ why you don't use dev_errĀ  => the device name will be displayed

> 

> 2/ why __func__ is used here, it is not needed with log macro

> 

> proposal:

> 

> - log_err("%s: OP-TEE capabilities mismatch\n", __func__);

> 

> + dev_err(dev, "OP-TEE capabilities mismatch\n");


Sure, this looks better. Let me change that and send a v2

Thanks
/Ilias
> 

> 

> Thanks

> Patrick

> 

>
diff mbox series

Patch

diff --git a/drivers/tee/optee/core.c b/drivers/tee/optee/core.c
index b898c32edc0b..1b0a7c0c9668 100644
--- a/drivers/tee/optee/core.c
+++ b/drivers/tee/optee/core.c
@@ -624,14 +624,14 @@  static int optee_probe(struct udevice *dev)
 	u32 sec_caps;
 
 	if (!is_optee_api(pdata->invoke_fn)) {
-		debug("%s: OP-TEE api uid mismatch\n", __func__);
+		log_err("%s: OP-TEE api uid mismatch\n", __func__);
 		return -ENOENT;
 	}
 
 	print_os_revision(dev, pdata->invoke_fn);
 
 	if (!api_revision_is_compatible(pdata->invoke_fn)) {
-		debug("%s: OP-TEE api revision mismatch\n", __func__);
+		log_err("%s: OP-TEE api revision mismatch\n", __func__);
 		return -ENOENT;
 	}
 
@@ -642,7 +642,7 @@  static int optee_probe(struct udevice *dev)
 	 */
 	if (!exchange_capabilities(pdata->invoke_fn, &sec_caps) ||
 	    !(sec_caps & OPTEE_SMC_SEC_CAP_DYNAMIC_SHM)) {
-		debug("%s: OP-TEE capabilities mismatch\n", __func__);
+		log_err("%s: OP-TEE capabilities mismatch\n", __func__);
 		return -ENOENT;
 	}