From 9b89d0ca04b2e7b60e682a85a518deb20783f2da Mon Sep 17 00:00:00 2001 From: Bob Lee Date: Mon, 21 Oct 2024 00:33:06 +0800 Subject: [PATCH] Fix incorrect failure handling in vinput_init After class_register failure, the wrong function class_unregister was used. The correct cleanup function should be unregister_chrdev, as register_chrdev was used before class_register. --- examples/vinput.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/vinput.c b/examples/vinput.c index ff226e2..41baed4 100644 --- a/examples/vinput.c +++ b/examples/vinput.c @@ -401,7 +401,7 @@ static int __init vinput_init(void) return 0; failed_class: - class_unregister(&vinput_class); + unregister_chrdev(vinput_dev, DRIVER_NAME); failed_alloc: return err; }