Skip to contentSkip to conversation

tcm_qla2xxx: checking for NULL instead of IS_ERR()

PATCH In review Dan Carpenter 2 participants 2 messages Mar 13, 2012 – Mar 15, 2012

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tcm_qla2xxx: checking for NULL instead of IS_ERR()

target_fabric_configfs_init() never returns NULLs, only ERR_PTRs.

drivers/scsi/qla2xxx/tcm_qla2xxx.c +2 -2
index dcbcedc..08cf507 100644
@@ -1885,9 +1885,9 @@ static int tcm_qla2xxx_register_configfs(void)
 	 * Register the top level struct config_item_type for NPIV with TCM core
 	 */
 	npiv_fabric = target_fabric_configfs_init(THIS_MODULE, "qla2xxx_npiv");
-	if (!npiv_fabric) {
+	if (IS_ERR(npiv_fabric)) {
 		pr_err("target_fabric_configfs_init() failed\n");
-		ret = -ENOMEM;
+		ret = PTR_ERR(npiv_fabric);
 		goto out_fabric;
 	}
 	/*
#1 lore raw
Quoted 10 lines · Dan Carpenter

target_fabric_configfs_init() never returns NULLs, only ERR_PTRs.

drivers/scsi/qla2xxx/tcm_qla2xxx.c +0 -0
index dcbcedc..08cf507 100644
@@ -1885,9 +1885,9 @@ static int tcm_qla2xxx_register_configfs(void)
 	 * Register the top level struct config_item_type for NPIV with TCM core

drivers/scsi/qla2xxx/tcm_qla2xxx.c static int tcm_qla2xxx_register_configfs(void) · line 1893

Quoted 10 lines
drivers/scsi/qla2xxx/tcm_qla2xxx.c +2 -2
 	 */
 	npiv_fabric = target_fabric_configfs_init(THIS_MODULE, "qla2xxx_npiv");
-	if (!npiv_fabric) {
+	if (IS_ERR(npiv_fabric)) {
 		pr_err("target_fabric_configfs_init() failed\n");
-		ret = -ENOMEM;
+		ret = PTR_ERR(npiv_fabric);
 		goto out_fabric;
 	}
 	/*

Doh, missed this fix for the qla2xxx_npiv fabric_ops allocation.. Applied to lio-core and will get fixed up for-next-merge.

Thanks Dan!

--nab