linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] scsi: Use PTR_ERR_OR_ZERO to replace the open code
@ 2018-08-13 11:10 zhong jiang
  2018-08-13 11:10 ` [PATCH 1/2] scsi:ufs: " zhong jiang
  2018-08-13 11:10 ` [PATCH 2/2] scsi:qla2xxx: " zhong jiang
  0 siblings, 2 replies; 3+ messages in thread
From: zhong jiang @ 2018-08-13 11:10 UTC (permalink / raw)
  To: jejb, martin.petersen; +Cc: john.garry, linux-scsi, linux-kernel

The issue is detected with the help of Coccinelle.

zhong jiang (2):
  scsi:ufs: Use PTR_ERR_OR_ZERO to replace the open code
  scsi:qla2xxx: Use PTR_ERR_OR_ZERO to replace the open code

 drivers/scsi/qla2xxx/tcm_qla2xxx.c | 6 ++----
 drivers/scsi/ufs/ufs-hisi.c        | 4 +---
 2 files changed, 3 insertions(+), 7 deletions(-)

-- 
1.7.12.4


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 1/2] scsi:ufs: Use PTR_ERR_OR_ZERO to replace the open code
  2018-08-13 11:10 [PATCH 0/2] scsi: Use PTR_ERR_OR_ZERO to replace the open code zhong jiang
@ 2018-08-13 11:10 ` zhong jiang
  2018-08-13 11:10 ` [PATCH 2/2] scsi:qla2xxx: " zhong jiang
  1 sibling, 0 replies; 3+ messages in thread
From: zhong jiang @ 2018-08-13 11:10 UTC (permalink / raw)
  To: jejb, martin.petersen; +Cc: john.garry, linux-scsi, linux-kernel

PTR_ERR_OR_ZERO has implemented the if(IS_ERR(...)) + PTR_ERR, So
just replace them rather than duplicating its implement.

Signed-off-by: zhong jiang <zhongjiang@huawei.com>
---
 drivers/scsi/ufs/ufs-hisi.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/scsi/ufs/ufs-hisi.c b/drivers/scsi/ufs/ufs-hisi.c
index 46df707..e794994 100644
--- a/drivers/scsi/ufs/ufs-hisi.c
+++ b/drivers/scsi/ufs/ufs-hisi.c
@@ -505,10 +505,8 @@ static int ufs_hisi_get_resource(struct ufs_hisi_host *host)
 	/* get resource of ufs sys ctrl */
 	mem_res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
 	host->ufs_sys_ctrl = devm_ioremap_resource(dev, mem_res);
-	if (IS_ERR(host->ufs_sys_ctrl))
-		return PTR_ERR(host->ufs_sys_ctrl);
 
-	return 0;
+	return PTR_ERR_OR_ZERO(host->ufs_sys_ctrl);
 }
 
 static void ufs_hisi_set_pm_lvl(struct ufs_hba *hba)
-- 
1.7.12.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] scsi:qla2xxx: Use PTR_ERR_OR_ZERO to replace the open code
  2018-08-13 11:10 [PATCH 0/2] scsi: Use PTR_ERR_OR_ZERO to replace the open code zhong jiang
  2018-08-13 11:10 ` [PATCH 1/2] scsi:ufs: " zhong jiang
@ 2018-08-13 11:10 ` zhong jiang
  1 sibling, 0 replies; 3+ messages in thread
From: zhong jiang @ 2018-08-13 11:10 UTC (permalink / raw)
  To: jejb, martin.petersen; +Cc: john.garry, linux-scsi, linux-kernel

PTR_ERR_OR_ZERO has implemented the if(IS_ERR(...)) + PTR_ERR, So
just replace them rather than duplicating its implement.

Signed-off-by: zhong jiang <zhongjiang@huawei.com>
---
 drivers/scsi/qla2xxx/tcm_qla2xxx.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/scsi/qla2xxx/tcm_qla2xxx.c b/drivers/scsi/qla2xxx/tcm_qla2xxx.c
index e03d12a..616f139 100644
--- a/drivers/scsi/qla2xxx/tcm_qla2xxx.c
+++ b/drivers/scsi/qla2xxx/tcm_qla2xxx.c
@@ -1542,10 +1542,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,
-- 
1.7.12.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-08-13 11:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-13 11:10 [PATCH 0/2] scsi: Use PTR_ERR_OR_ZERO to replace the open code zhong jiang
2018-08-13 11:10 ` [PATCH 1/2] scsi:ufs: " zhong jiang
2018-08-13 11:10 ` [PATCH 2/2] scsi:qla2xxx: " zhong jiang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).