diff options
author | Stefan Berger <stefanb@linux.vnet.ibm.com> | 2011-07-22 17:39:20 -0400 |
---|---|---|
committer | James Morris <jmorris@namei.org> | 2011-07-25 20:34:34 -0400 |
commit | 29412f0f6a19e34336368f13eab848091c343952 (patch) | |
tree | 36c1c422022b4cfb4a98b60dd936ca4f98d24911 /drivers/char | |
parent | 968543100a75bef892f52eb86e92e83b3b7bc581 (diff) |
tpm_nsc: Fix bug when loading multiple TPM drivers
This patch fixes kernel bugzilla 34572.
https://bugzilla.kernel.org/show_bug.cgi?id=34572
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Reported-by: Witold Baryluk <baryluk@smp.if.uj.edu.pl>
Tested-by: Witold Baryluk <baryluk@smp.if.uj.edu.pl>
Signed-off-by: James Morris <jmorris@namei.org>
Diffstat (limited to 'drivers/char')
-rw-r--r-- | drivers/char/tpm/tpm_nsc.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/drivers/char/tpm/tpm_nsc.c b/drivers/char/tpm/tpm_nsc.c index a605cb7dd898..82facc9104c7 100644 --- a/drivers/char/tpm/tpm_nsc.c +++ b/drivers/char/tpm/tpm_nsc.c | |||
@@ -330,12 +330,12 @@ static int __init init_nsc(void) | |||
330 | pdev->dev.driver = &nsc_drv.driver; | 330 | pdev->dev.driver = &nsc_drv.driver; |
331 | pdev->dev.release = tpm_nsc_remove; | 331 | pdev->dev.release = tpm_nsc_remove; |
332 | 332 | ||
333 | if ((rc = platform_device_register(pdev)) < 0) | 333 | if ((rc = platform_device_add(pdev)) < 0) |
334 | goto err_free_dev; | 334 | goto err_put_dev; |
335 | 335 | ||
336 | if (request_region(base, 2, "tpm_nsc0") == NULL ) { | 336 | if (request_region(base, 2, "tpm_nsc0") == NULL ) { |
337 | rc = -EBUSY; | 337 | rc = -EBUSY; |
338 | goto err_unreg_dev; | 338 | goto err_del_dev; |
339 | } | 339 | } |
340 | 340 | ||
341 | if (!(chip = tpm_register_hardware(&pdev->dev, &tpm_nsc))) { | 341 | if (!(chip = tpm_register_hardware(&pdev->dev, &tpm_nsc))) { |
@@ -382,10 +382,10 @@ static int __init init_nsc(void) | |||
382 | 382 | ||
383 | err_rel_reg: | 383 | err_rel_reg: |
384 | release_region(base, 2); | 384 | release_region(base, 2); |
385 | err_unreg_dev: | 385 | err_del_dev: |
386 | platform_device_unregister(pdev); | 386 | platform_device_del(pdev); |
387 | err_free_dev: | 387 | err_put_dev: |
388 | kfree(pdev); | 388 | platform_device_put(pdev); |
389 | err_unreg_drv: | 389 | err_unreg_drv: |
390 | platform_driver_unregister(&nsc_drv); | 390 | platform_driver_unregister(&nsc_drv); |
391 | return rc; | 391 | return rc; |