public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tpm_tis: fix missing platform_driver_unregister
@ 2013-05-02 11:39 Libo Chen
  2013-05-02 13:43 ` Kent Yoder
  0 siblings, 1 reply; 2+ messages in thread
From: Libo Chen @ 2013-05-02 11:39 UTC (permalink / raw)
  To: key, mail, tpmdd, tpmdd; +Cc: tpmdd-devel, linux-kernel, Li Zefan


Add missing unregister tis_drv after register pdev fail

Signed-off-by: Libo Chen <libo.chen@huawei.com>
---
 drivers/char/tpm/tpm_tis.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/char/tpm/tpm_tis.c b/drivers/char/tpm/tpm_tis.c
index 8a41b6b..d5b0af4 100644
--- a/drivers/char/tpm/tpm_tis.c
+++ b/drivers/char/tpm/tpm_tis.c
@@ -884,8 +884,11 @@ static int __init init_tis(void)
 	rc = platform_driver_register(&tis_drv);
 	if (rc < 0)
 		return rc;
-	if (IS_ERR(pdev=platform_device_register_simple("tpm_tis", -1, NULL, 0)))
-		return PTR_ERR(pdev);
+	pdev = platform_device_register_simple("tpm_tis", -1, NULL, 0);
+	if (IS_ERR(pdev) {
+	    platform_driver_unregister(&tis_drv);
+	    return PTR_ERR(pdev);
+	}
 	if((rc=tpm_tis_init(&pdev->dev, TIS_MEM_BASE, TIS_MEM_LEN, 0)) != 0) {
 		platform_device_unregister(pdev);
 		platform_driver_unregister(&tis_drv);
-- 
1.7.1


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

* Re: [PATCH] tpm_tis: fix missing platform_driver_unregister
  2013-05-02 11:39 [PATCH] tpm_tis: fix missing platform_driver_unregister Libo Chen
@ 2013-05-02 13:43 ` Kent Yoder
  0 siblings, 0 replies; 2+ messages in thread
From: Kent Yoder @ 2013-05-02 13:43 UTC (permalink / raw)
  To: Libo Chen; +Cc: mail, tpmdd, tpmdd, tpmdd-devel, linux-kernel, Li Zefan

On Thu, May 02, 2013 at 07:39:50PM +0800, Libo Chen wrote:
> 
> Add missing unregister tis_drv after register pdev fail
> 
> Signed-off-by: Libo Chen <libo.chen@huawei.com>

  Hi Libo - thanks for the contribution, but I got an similar patch
last week from Wei Yongjun. Its staged over here [1] and will be pushed
soon.

Thanks,
Kent

[1] git://github.com/shpedoikal/linux.git tpmdd-04-26-13

> ---
>  drivers/char/tpm/tpm_tis.c |    7 +++++--
>  1 files changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/char/tpm/tpm_tis.c b/drivers/char/tpm/tpm_tis.c
> index 8a41b6b..d5b0af4 100644
> --- a/drivers/char/tpm/tpm_tis.c
> +++ b/drivers/char/tpm/tpm_tis.c
> @@ -884,8 +884,11 @@ static int __init init_tis(void)
>  	rc = platform_driver_register(&tis_drv);
>  	if (rc < 0)
>  		return rc;
> -	if (IS_ERR(pdev=platform_device_register_simple("tpm_tis", -1, NULL, 0)))
> -		return PTR_ERR(pdev);
> +	pdev = platform_device_register_simple("tpm_tis", -1, NULL, 0);
> +	if (IS_ERR(pdev) {
> +	    platform_driver_unregister(&tis_drv);
> +	    return PTR_ERR(pdev);
> +	}
>  	if((rc=tpm_tis_init(&pdev->dev, TIS_MEM_BASE, TIS_MEM_LEN, 0)) != 0) {
>  		platform_device_unregister(pdev);
>  		platform_driver_unregister(&tis_drv);
> -- 
> 1.7.1
> 


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

end of thread, other threads:[~2013-05-02 13:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-02 11:39 [PATCH] tpm_tis: fix missing platform_driver_unregister Libo Chen
2013-05-02 13:43 ` Kent Yoder

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox