cris: return of class_create should be considered
Return value of class_create should be considered in module init function.
Signed-off-by: Zhouyi Zhou <zhouzhouyi@gmail.com>
Signed-off-by: Jesper Nilsson <jespern@axis.com>
diff --git a/arch/cris/arch-v32/drivers/sync_serial.c b/arch/cris/arch-v32/drivers/sync_serial.c
index e989cee..ef515af 100644
--- a/arch/cris/arch-v32/drivers/sync_serial.c
+++ b/arch/cris/arch-v32/drivers/sync_serial.c
@@ -1627,6 +1627,12 @@
/* Create a sysfs class for syncser */
syncser_class = class_create(THIS_MODULE, "syncser_class");
+ if (IS_ERR(syncser_class)) {
+ pr_err("Failed to create a sysfs class for syncser\n");
+ unregister_chrdev_region(syncser_first, minor_count);
+ cdev_del(syncser_cdev);
+ return -1;
+ }
/* Initialize Ports */
#if defined(CONFIG_ETRAX_SYNCHRONOUS_SERIAL_PORT0)