Skip to contentSkip to conversation

scsi: qla2xxx: use PTR_ERR_OR_ZERO() to simplify code

PATCH In review Chen Zhou 2 participants 2 messages Jan 22, 2020 – Jan 23, 2020

Subsystems (2)
lore
Share & tools
lore

Chen Zhou

author
#0 lore raw

PATCH 1/1 scsi: qla2xxx: use PTR_ERR_OR_ZERO() to simplify code

PTR_ERR_OR_ZERO contains if(IS_ERR(...)) + PTR_ERR, just use PTR_ERR_OR_ZERO directly.

---
 drivers/scsi/qla2xxx/tcm_qla2xxx.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/scsi/qla2xxx/tcm_qla2xxx.c +1 -3
index abe7f79..719d53d 100644
@@ -1462,10 +1462,8 @@ static int tcm_qla2xxx_check_initiator_node_acl(
 				       sizeof(struct qla_tgt_cmd),
 				       TARGET_PROT_ALL, port_name,
 				       qlat_sess, tcm_qla2xxx_session_cb);
-	if (IS_ERR(se_sess))
-		return PTR_ERR(se_sess);
 
-	return 0;
+	return PTR_ERR_OR_ZERO(se_sess);
 }
 
 static void tcm_qla2xxx_update_sess(struct fc_port *sess, port_id_t s_id,
Signature · 1 line
2.7.4
#1 lore raw
Quoted 13 lines · Chen Zhou

PTR_ERR_OR_ZERO contains if(IS_ERR(...)) + PTR_ERR, just use PTR_ERR_OR_ZERO directly.

---
 drivers/scsi/qla2xxx/tcm_qla2xxx.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/scsi/qla2xxx/tcm_qla2xxx.c +0 -0
index abe7f79..719d53d 100644

drivers/scsi/qla2xxx/tcm_qla2xxx.c static int tcm_qla2xxx_check_initiator_node_acl( · line 1467

Quoted 9 lines
drivers/scsi/qla2xxx/tcm_qla2xxx.c +1 -3
@@ -1462,10 +1462,8 @@ static int tcm_qla2xxx_check_initiator_node_acl(
 				       sizeof(struct qla_tgt_cmd),
 				       TARGET_PROT_ALL, port_name,
 				       qlat_sess, tcm_qla2xxx_session_cb);
-	if (IS_ERR(se_sess))
-		return PTR_ERR(se_sess);
 
-	return 0;
+	return PTR_ERR_OR_ZERO(se_sess);
 }

Is this a useful change? My personal opinion is that the current implementation (without this patch) is easier to read.

Thanks,

Bart.