[PATCH] staging: comedi: comedi_test: return error when comedi_test_init fails

Chuhong Yuan hslester96 at gmail.com
Tue Dec 10 09:14:51 UTC 2019


comedi_test_init() forgets to return error when it fails.
Modify the return value to fix it.

Fixes: 9ff7400bd38c ("Staging: comedi: drivers: comedi_test: Add auto-configuration capability")
Signed-off-by: Chuhong Yuan <hslester96 at gmail.com>
---
 drivers/staging/comedi/drivers/comedi_test.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/comedi/drivers/comedi_test.c b/drivers/staging/comedi/drivers/comedi_test.c
index ef4c7c8a2b71..133ed99a89f1 100644
--- a/drivers/staging/comedi/drivers/comedi_test.c
+++ b/drivers/staging/comedi/drivers/comedi_test.c
@@ -799,12 +799,14 @@ static int __init comedi_test_init(void)
 	if (!config_mode) {
 		ctcls = class_create(THIS_MODULE, CLASS_NAME);
 		if (IS_ERR(ctcls)) {
+			ret = PTR_ERR(ctcls);
 			pr_warn("comedi_test: unable to create class\n");
 			goto clean3;
 		}
 
 		ctdev = device_create(ctcls, NULL, MKDEV(0, 0), NULL, DEV_NAME);
 		if (IS_ERR(ctdev)) {
+			ret = PTR_ERR(ctdev);
 			pr_warn("comedi_test: unable to create device\n");
 			goto clean2;
 		}
@@ -826,7 +828,7 @@ static int __init comedi_test_init(void)
 clean3:
 	ctcls = NULL;
 
-	return 0;
+	return ret;
 }
 module_init(comedi_test_init);
 
-- 
2.24.0



More information about the devel mailing list