summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZhouyi Zhou <yizhouzhou@ict.ac.cn>2016-08-10 16:06:43 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-08-31 14:47:54 +0200
commitc1e8ad231141be21471d2cc624773eb5250c07b3 (patch)
treeb257365b354e4b3c7a5ff3aca082625297593eac
parent26ec99b105d5d1465fffed563cfe1a90a7b150fd (diff)
downloadop-kernel-dev-c1e8ad231141be21471d2cc624773eb5250c07b3.zip
op-kernel-dev-c1e8ad231141be21471d2cc624773eb5250c07b3.tar.gz
snsc: check return value of class_create
return value of class_create should be considered in module init function. Signed-off-by: Zhouyi Zhou <zhouzhouyi@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/char/snsc.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/char/snsc.c b/drivers/char/snsc.c
index 94006f9..10e5632 100644
--- a/drivers/char/snsc.c
+++ b/drivers/char/snsc.c
@@ -385,13 +385,18 @@ scdrv_init(void)
event_nasid = ia64_sn_get_console_nasid();
+ snsc_class = class_create(THIS_MODULE, SYSCTL_BASENAME);
+ if (IS_ERR(snsc_class)) {
+ printk("%s: failed to allocate class\n", __func__);
+ return PTR_ERR(snsc_class);
+ }
+
if (alloc_chrdev_region(&first_dev, 0, num_cnodes,
SYSCTL_BASENAME) < 0) {
printk("%s: failed to register SN system controller device\n",
__func__);
return -ENODEV;
}
- snsc_class = class_create(THIS_MODULE, SYSCTL_BASENAME);
for (cnode = 0; cnode < num_cnodes; cnode++) {
geoid = cnodeid_get_geoid(cnode);
OpenPOWER on IntegriCloud