summaryrefslogtreecommitdiffstats
path: root/drivers/char
diff options
context:
space:
mode:
authorWei Yongjun <yongjun_wei@trendmicro.com.cn>2013-04-25 15:07:47 +0800
committerKent Yoder <key@linux.vnet.ibm.com>2013-05-21 12:24:48 -0500
commit4fba3c3ba5c6b7803f36db7d56a58fa3226458d9 (patch)
treee389f3d78fa3539a14740958fde42cafb158b145 /drivers/char
parent4726e8fa1dcad533362475ebf91f70d5b6b6292f (diff)
downloadblackbird-op-linux-4fba3c3ba5c6b7803f36db7d56a58fa3226458d9.tar.gz
blackbird-op-linux-4fba3c3ba5c6b7803f36db7d56a58fa3226458d9.zip
tpm_tis: missing platform_driver_unregister() on error in init_tis()
Add the missing platform_driver_unregister() before return from init_tis() in the device register error handling case. Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn> Signed-off-by: Kent Yoder <key@linux.vnet.ibm.com>
Diffstat (limited to 'drivers/char')
-rw-r--r--drivers/char/tpm/tpm_tis.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/drivers/char/tpm/tpm_tis.c b/drivers/char/tpm/tpm_tis.c
index 8a41b6be23a0..4519cb332987 100644
--- a/drivers/char/tpm/tpm_tis.c
+++ b/drivers/char/tpm/tpm_tis.c
@@ -884,12 +884,19 @@ 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);
- if((rc=tpm_tis_init(&pdev->dev, TIS_MEM_BASE, TIS_MEM_LEN, 0)) != 0) {
- platform_device_unregister(pdev);
- platform_driver_unregister(&tis_drv);
+ pdev = platform_device_register_simple("tpm_tis", -1, NULL, 0);
+ if (IS_ERR(pdev)) {
+ rc = PTR_ERR(pdev);
+ goto err_dev;
}
+ rc = tpm_tis_init(&pdev->dev, TIS_MEM_BASE, TIS_MEM_LEN, 0);
+ if (rc)
+ goto err_init;
+ return 0;
+err_init:
+ platform_device_unregister(pdev);
+err_dev:
+ platform_driver_unregister(&tis_drv);
return rc;
}
OpenPOWER on IntegriCloud