hc
2024-05-10 23fa18eaa71266feff7ba8d83022d9e1cc83c65a
kernel/drivers/char/tpm/tpm_vtpm_proxy.c
....@@ -683,37 +683,21 @@
683683 .fops = &vtpmx_fops,
684684 };
685685
686
-static int vtpmx_init(void)
687
-{
688
- return misc_register(&vtpmx_miscdev);
689
-}
690
-
691
-static void vtpmx_cleanup(void)
692
-{
693
- misc_deregister(&vtpmx_miscdev);
694
-}
695
-
696686 static int __init vtpm_module_init(void)
697687 {
698688 int rc;
699689
700
- rc = vtpmx_init();
701
- if (rc) {
702
- pr_err("couldn't create vtpmx device\n");
703
- return rc;
704
- }
705
-
706690 workqueue = create_workqueue("tpm-vtpm");
707691 if (!workqueue) {
708692 pr_err("couldn't create workqueue\n");
709
- rc = -ENOMEM;
710
- goto err_vtpmx_cleanup;
693
+ return -ENOMEM;
711694 }
712695
713
- return 0;
714
-
715
-err_vtpmx_cleanup:
716
- vtpmx_cleanup();
696
+ rc = misc_register(&vtpmx_miscdev);
697
+ if (rc) {
698
+ pr_err("couldn't create vtpmx device\n");
699
+ destroy_workqueue(workqueue);
700
+ }
717701
718702 return rc;
719703 }
....@@ -721,7 +705,7 @@
721705 static void __exit vtpm_module_exit(void)
722706 {
723707 destroy_workqueue(workqueue);
724
- vtpmx_cleanup();
708
+ misc_deregister(&vtpmx_miscdev);
725709 }
726710
727711 module_init(vtpm_module_init);