Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4fba3c3b authored by Wei Yongjun's avatar Wei Yongjun Committed by Kent Yoder
Browse files

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: default avatarWei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: default avatarKent Yoder <key@linux.vnet.ibm.com>
parent 4726e8fa
Loading
Loading
Loading
Loading
+12 −5
Original line number Diff line number Diff line
@@ -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) {
	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;
}