ir: fix coverity unchecked return value issue [1/1]
authorQianggui Song <qianggui.song@amlogic.com>
Wed, 11 Sep 2019 09:22:50 +0000 (17:22 +0800)
committerTao Zeng <tao.zeng@amlogic.com>
Wed, 18 Sep 2019 10:34:04 +0000 (03:34 -0700)
PD#SWPL-13969

Problem:
In sysfs.c, return value of class_register is not checked.

Solution:
check return value of class_register

Verify:
local coverity check

Change-Id: If8deb3e388e784650e4812257143c3ac919c2d9a
Signed-off-by: Qianggui Song <qianggui.song@amlogic.com>
drivers/amlogic/input/remote/sysfs.c

index a6adb4f190c8d40648673f550060cbb9bf4e28f1..03e8b887b4a2c9c74399db76a4bf613fd44962a5 100644 (file)
@@ -523,8 +523,11 @@ static struct class remote_class = {
 int ir_sys_device_attribute_init(struct remote_chip *chip)
 {
        struct device *dev;
+       int err;
 
-       class_register(&remote_class);
+       err = class_register(&remote_class);
+       if (unlikely(err))
+               return err;
 
        dev = device_create(&remote_class,  NULL,
                                        chip->chr_devno, chip, chip->dev_name);