[PATCH 1/1] xilinx: check return value of class_create

yizhouzhou at ict.ac.cn yizhouzhou at ict.ac.cn
Wed Aug 10 01:08:22 PDT 2016


From: Zhouyi Zhou <yizhouzhou at ict.ac.cn>

	 return value of class_create should be considered in
module init function.

Signed-off-by: Zhouyi Zhou <zhouzhouyi at gmail.com>
---
 drivers/char/xilinx_hwicap/xilinx_hwicap.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/char/xilinx_hwicap/xilinx_hwicap.c b/drivers/char/xilinx_hwicap/xilinx_hwicap.c
index c07dfe5..3877b46 100644
--- a/drivers/char/xilinx_hwicap/xilinx_hwicap.c
+++ b/drivers/char/xilinx_hwicap/xilinx_hwicap.c
@@ -854,6 +854,9 @@ static int __init hwicap_module_init(void)
 	int retval;
 
 	icap_class = class_create(THIS_MODULE, "xilinx_config");
+	if (IS_ERR(icap_class))
+		return PTR_ERR(icap_class);
+
 	mutex_init(&icap_sem);
 
 	devt = MKDEV(XHWICAP_MAJOR, XHWICAP_MINOR);
-- 
1.9.1





More information about the linux-arm-kernel mailing list