linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] tpm_tis: Fix an error handling path in 'tpm_tis_core_init()'
@ 2021-11-06 16:42 Christophe JAILLET
  2021-11-07 17:04 ` Jarkko Sakkinen
  0 siblings, 1 reply; 2+ messages in thread
From: Christophe JAILLET @ 2021-11-06 16:42 UTC (permalink / raw)
  To: peterhuewe, jarkko, jgg, hao.wu
  Cc: linux-integrity, linux-kernel, kernel-janitors, Christophe JAILLET

Commit 79ca6f74dae0 ("tpm: fix Atmel TPM crash caused by too frequent
queries") has moved some code around without updating the error handling
path.

This is now pointless to 'goto out_err' when neither 'clk_enable()' nor
'ioremap()' have been called yet.

Make a direct return instead to avoid undoing things that have not been
done.

Fixes: 79ca6f74dae0 ("tpm: fix Atmel TPM crash caused by too frequent queries")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 drivers/char/tpm/tpm_tis_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/char/tpm/tpm_tis_core.c b/drivers/char/tpm/tpm_tis_core.c
index b2659a4c4016..e672d2dc8937 100644
--- a/drivers/char/tpm/tpm_tis_core.c
+++ b/drivers/char/tpm/tpm_tis_core.c
@@ -952,7 +952,7 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq,
 
 	rc = tpm_tis_read32(priv, TPM_DID_VID(0), &vendor);
 	if (rc < 0)
-		goto out_err;
+		return rc;
 
 	priv->manufacturer_id = vendor;
 
-- 
2.30.2


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

* Re: [PATCH] tpm_tis: Fix an error handling path in 'tpm_tis_core_init()'
  2021-11-06 16:42 [PATCH] tpm_tis: Fix an error handling path in 'tpm_tis_core_init()' Christophe JAILLET
@ 2021-11-07 17:04 ` Jarkko Sakkinen
  0 siblings, 0 replies; 2+ messages in thread
From: Jarkko Sakkinen @ 2021-11-07 17:04 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: peterhuewe, jgg, hao.wu, linux-integrity, linux-kernel, kernel-janitors

On Sat, Nov 06, 2021 at 05:42:04PM +0100, Christophe JAILLET wrote:
> Commit 79ca6f74dae0 ("tpm: fix Atmel TPM crash caused by too frequent
> queries") has moved some code around without updating the error handling
> path.
> 
> This is now pointless to 'goto out_err' when neither 'clk_enable()' nor
> 'ioremap()' have been called yet.
> 
> Make a direct return instead to avoid undoing things that have not been
> done.
> 
> Fixes: 79ca6f74dae0 ("tpm: fix Atmel TPM crash caused by too frequent queries")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
>  drivers/char/tpm/tpm_tis_core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/char/tpm/tpm_tis_core.c b/drivers/char/tpm/tpm_tis_core.c
> index b2659a4c4016..e672d2dc8937 100644
> --- a/drivers/char/tpm/tpm_tis_core.c
> +++ b/drivers/char/tpm/tpm_tis_core.c
> @@ -952,7 +952,7 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq,
>  
>  	rc = tpm_tis_read32(priv, TPM_DID_VID(0), &vendor);
>  	if (rc < 0)
> -		goto out_err;
> +		return rc;
>  
>  	priv->manufacturer_id = vendor;
>  
> -- 
> 2.30.2
> 

Thank you.

Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>

/Jarkko

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

end of thread, other threads:[~2021-11-07 17:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-06 16:42 [PATCH] tpm_tis: Fix an error handling path in 'tpm_tis_core_init()' Christophe JAILLET
2021-11-07 17:04 ` Jarkko Sakkinen

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