All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tpm: fix node pointer lookup
@ 2016-11-15 15:57 ` Arnd Bergmann
  0 siblings, 0 replies; 3+ messages in thread
From: Arnd Bergmann @ 2016-11-15 15:57 UTC (permalink / raw)
  To: Jarkko Sakkinen
  Cc: Arnd Bergmann, Peter Huewe, Marcel Selhorst, Jason Gunthorpe,
	Nayna Jain, tpmdd-devel, linux-kernel

A rework left the node pointer uninitialized when the device tree
is not in use:

drivers/char/tpm/tpm_of.c: In function 'read_log_of':
drivers/char/tpm/tpm_of.c:37:8: error: 'np' may be used uninitialized in this function [-Werror=maybe-uninitialized]

This reverts the behavior to what it should be.

Fixes: 4a45d9669ac1 ("tpm: replace of_find_node_by_name() with dev of_node property")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/char/tpm/tpm_of.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/char/tpm/tpm_of.c b/drivers/char/tpm/tpm_of.c
index 3af829f3ad59..24fa6afc2e55 100644
--- a/drivers/char/tpm/tpm_of.c
+++ b/drivers/char/tpm/tpm_of.c
@@ -29,8 +29,7 @@ int read_log_of(struct tpm_chip *chip)
 	struct tpm_bios_log *log;
 
 	log = &chip->log;
-	if (chip->dev.parent->of_node)
-		np = chip->dev.parent->of_node;
+	np = chip->dev.parent->of_node;
 	if (!np)
 		return -ENODEV;
 
-- 
2.9.0

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

* [PATCH] tpm: fix node pointer lookup
@ 2016-11-15 15:57 ` Arnd Bergmann
  0 siblings, 0 replies; 3+ messages in thread
From: Arnd Bergmann @ 2016-11-15 15:57 UTC (permalink / raw)
  To: Jarkko Sakkinen
  Cc: Arnd Bergmann, linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

A rework left the node pointer uninitialized when the device tree
is not in use:

drivers/char/tpm/tpm_of.c: In function 'read_log_of':
drivers/char/tpm/tpm_of.c:37:8: error: 'np' may be used uninitialized in this function [-Werror=maybe-uninitialized]

This reverts the behavior to what it should be.

Fixes: 4a45d9669ac1 ("tpm: replace of_find_node_by_name() with dev of_node property")
Signed-off-by: Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>
---
 drivers/char/tpm/tpm_of.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/char/tpm/tpm_of.c b/drivers/char/tpm/tpm_of.c
index 3af829f3ad59..24fa6afc2e55 100644
--- a/drivers/char/tpm/tpm_of.c
+++ b/drivers/char/tpm/tpm_of.c
@@ -29,8 +29,7 @@ int read_log_of(struct tpm_chip *chip)
 	struct tpm_bios_log *log;
 
 	log = &chip->log;
-	if (chip->dev.parent->of_node)
-		np = chip->dev.parent->of_node;
+	np = chip->dev.parent->of_node;
 	if (!np)
 		return -ENODEV;
 
-- 
2.9.0


------------------------------------------------------------------------------

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

* Re: [PATCH] tpm: fix node pointer lookup
  2016-11-15 15:57 ` Arnd Bergmann
  (?)
@ 2016-11-15 17:36 ` Jarkko Sakkinen
  -1 siblings, 0 replies; 3+ messages in thread
From: Jarkko Sakkinen @ 2016-11-15 17:36 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Peter Huewe, Marcel Selhorst, Jason Gunthorpe, Nayna Jain,
	tpmdd-devel, linux-kernel

On Tue, Nov 15, 2016 at 04:57:11PM +0100, Arnd Bergmann wrote:
> A rework left the node pointer uninitialized when the device tree
> is not in use:
> 
> drivers/char/tpm/tpm_of.c: In function 'read_log_of':
> drivers/char/tpm/tpm_of.c:37:8: error: 'np' may be used uninitialized in this function [-Werror=maybe-uninitialized]
> 
> This reverts the behavior to what it should be.
> 
> Fixes: 4a45d9669ac1 ("tpm: replace of_find_node_by_name() with dev of_node property")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Arnd, I got patch from Colin a moment earlier so I applied that.
Thank you in any case!

/Jarkko

> ---
>  drivers/char/tpm/tpm_of.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/char/tpm/tpm_of.c b/drivers/char/tpm/tpm_of.c
> index 3af829f3ad59..24fa6afc2e55 100644
> --- a/drivers/char/tpm/tpm_of.c
> +++ b/drivers/char/tpm/tpm_of.c
> @@ -29,8 +29,7 @@ int read_log_of(struct tpm_chip *chip)
>  	struct tpm_bios_log *log;
>  
>  	log = &chip->log;
> -	if (chip->dev.parent->of_node)
> -		np = chip->dev.parent->of_node;
> +	np = chip->dev.parent->of_node;
>  	if (!np)
>  		return -ENODEV;
>  
> -- 
> 2.9.0
> 

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

end of thread, other threads:[~2016-11-15 17:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-15 15:57 [PATCH] tpm: fix node pointer lookup Arnd Bergmann
2016-11-15 15:57 ` Arnd Bergmann
2016-11-15 17:36 ` Jarkko Sakkinen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.