Skip to content

Commit

Permalink
tpm_nsc: Fix bug when loading multiple TPM drivers
Browse files Browse the repository at this point in the history
This patch fixes kernel bugzilla 34572.

https://bugzilla.kernel.org/show_bug.cgi?id=34572

Signed-off-by: Stefan Berger <[email protected]>
Reported-by: Witold Baryluk <[email protected]>
Tested-by: Witold Baryluk <[email protected]>
Signed-off-by: James Morris <[email protected]>
  • Loading branch information
stefanberger authored and James Morris committed Jul 26, 2011
1 parent 9685431 commit 29412f0
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions drivers/char/tpm/tpm_nsc.c
Original file line number Diff line number Diff line change
Expand Up @@ -330,12 +330,12 @@ static int __init init_nsc(void)
pdev->dev.driver = &nsc_drv.driver;
pdev->dev.release = tpm_nsc_remove;

if ((rc = platform_device_register(pdev)) < 0)
goto err_free_dev;
if ((rc = platform_device_add(pdev)) < 0)
goto err_put_dev;

if (request_region(base, 2, "tpm_nsc0") == NULL ) {
rc = -EBUSY;
goto err_unreg_dev;
goto err_del_dev;
}

if (!(chip = tpm_register_hardware(&pdev->dev, &tpm_nsc))) {
Expand Down Expand Up @@ -382,10 +382,10 @@ static int __init init_nsc(void)

err_rel_reg:
release_region(base, 2);
err_unreg_dev:
platform_device_unregister(pdev);
err_free_dev:
kfree(pdev);
err_del_dev:
platform_device_del(pdev);
err_put_dev:
platform_device_put(pdev);
err_unreg_drv:
platform_driver_unregister(&nsc_drv);
return rc;
Expand Down

0 comments on commit 29412f0

Please sign in to comment.