Commit 29412f0f authored by Stefan Berger's avatar Stefan Berger Committed by James Morris

tpm_nsc: Fix bug when loading multiple TPM drivers

This patch fixes kernel bugzilla 34572.

https://bugzilla.kernel.org/show_bug.cgi?id=34572Signed-off-by: default avatarStefan Berger <stefanb@linux.vnet.ibm.com>
Reported-by: default avatarWitold Baryluk <baryluk@smp.if.uj.edu.pl>
Tested-by: default avatarWitold Baryluk <baryluk@smp.if.uj.edu.pl>
Signed-off-by: default avatarJames Morris <jmorris@namei.org>
parent 96854310
...@@ -330,12 +330,12 @@ static int __init init_nsc(void) ...@@ -330,12 +330,12 @@ static int __init init_nsc(void)
pdev->dev.driver = &nsc_drv.driver; pdev->dev.driver = &nsc_drv.driver;
pdev->dev.release = tpm_nsc_remove; pdev->dev.release = tpm_nsc_remove;
if ((rc = platform_device_register(pdev)) < 0) if ((rc = platform_device_add(pdev)) < 0)
goto err_free_dev; goto err_put_dev;
if (request_region(base, 2, "tpm_nsc0") == NULL ) { if (request_region(base, 2, "tpm_nsc0") == NULL ) {
rc = -EBUSY; rc = -EBUSY;
goto err_unreg_dev; goto err_del_dev;
} }
if (!(chip = tpm_register_hardware(&pdev->dev, &tpm_nsc))) { if (!(chip = tpm_register_hardware(&pdev->dev, &tpm_nsc))) {
...@@ -382,10 +382,10 @@ static int __init init_nsc(void) ...@@ -382,10 +382,10 @@ static int __init init_nsc(void)
err_rel_reg: err_rel_reg:
release_region(base, 2); release_region(base, 2);
err_unreg_dev: err_del_dev:
platform_device_unregister(pdev); platform_device_del(pdev);
err_free_dev: err_put_dev:
kfree(pdev); platform_device_put(pdev);
err_unreg_drv: err_unreg_drv:
platform_driver_unregister(&nsc_drv); platform_driver_unregister(&nsc_drv);
return rc; return rc;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment