* [PATCH -next] scsi: qla2xxx: Use PTR_ERR_OR_ZERO() to simplify code
@ 2020-05-06 7:54 Samuel Zou
2020-05-06 15:42 ` Bart Van Assche
0 siblings, 1 reply; 4+ messages in thread
From: Samuel Zou @ 2020-05-06 7:54 UTC (permalink / raw)
To: njavali, GR-QLogic-Storage-Upstream, jejb, martin.petersen
Cc: linux-scsi, linux-kernel, Samuel Zou
Fixes coccicheck warning:
drivers/scsi/qla2xxx/tcm_qla2xxx.c:1488:1-3: WARNING: PTR_ERR_OR_ZERO can be used
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Samuel Zou <zou_wei@huawei.com>
---
drivers/scsi/qla2xxx/tcm_qla2xxx.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/scsi/qla2xxx/tcm_qla2xxx.c b/drivers/scsi/qla2xxx/tcm_qla2xxx.c
index 1f0a185..7c4157e 100644
--- a/drivers/scsi/qla2xxx/tcm_qla2xxx.c
+++ b/drivers/scsi/qla2xxx/tcm_qla2xxx.c
@@ -1485,10 +1485,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,
--
2.6.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH -next] scsi: qla2xxx: Use PTR_ERR_OR_ZERO() to simplify code
2020-05-06 7:54 [PATCH -next] scsi: qla2xxx: Use PTR_ERR_OR_ZERO() to simplify code Samuel Zou
@ 2020-05-06 15:42 ` Bart Van Assche
0 siblings, 0 replies; 4+ messages in thread
From: Bart Van Assche @ 2020-05-06 15:42 UTC (permalink / raw)
To: Samuel Zou, njavali, GR-QLogic-Storage-Upstream, jejb, martin.petersen
Cc: linux-scsi, linux-kernel
On 2020-05-06 00:54, Samuel Zou wrote:
> Fixes coccicheck warning:
>
> drivers/scsi/qla2xxx/tcm_qla2xxx.c:1488:1-3: WARNING: PTR_ERR_OR_ZERO can be used
>
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Samuel Zou <zou_wei@huawei.com>
> ---
> drivers/scsi/qla2xxx/tcm_qla2xxx.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/scsi/qla2xxx/tcm_qla2xxx.c b/drivers/scsi/qla2xxx/tcm_qla2xxx.c
> index 1f0a185..7c4157e 100644
> --- a/drivers/scsi/qla2xxx/tcm_qla2xxx.c
> +++ b/drivers/scsi/qla2xxx/tcm_qla2xxx.c
> @@ -1485,10 +1485,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);
> }
Can the Hulk check that verifies where PTR_ERR_OR_ZERO() can be
introduced be deactivated? I think this patch makes the code less
readable instead of making it more readable.
Thanks,
Bart.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH -next] scsi: qla2xxx: use PTR_ERR_OR_ZERO() to simplify code
@ 2020-01-22 10:18 Chen Zhou
2020-01-23 2:45 ` Bart Van Assche
0 siblings, 1 reply; 4+ messages in thread
From: Chen Zhou @ 2020-01-22 10:18 UTC (permalink / raw)
To: hmadhani, jejb, martin.petersen; +Cc: linux-scsi, linux-kernel, chenzhou10
PTR_ERR_OR_ZERO contains if(IS_ERR(...)) + PTR_ERR, just use
PTR_ERR_OR_ZERO directly.
Signed-off-by: Chen Zhou <chenzhou10@huawei.com>
---
drivers/scsi/qla2xxx/tcm_qla2xxx.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/scsi/qla2xxx/tcm_qla2xxx.c b/drivers/scsi/qla2xxx/tcm_qla2xxx.c
index abe7f79..719d53d 100644
--- a/drivers/scsi/qla2xxx/tcm_qla2xxx.c
+++ b/drivers/scsi/qla2xxx/tcm_qla2xxx.c
@@ -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,
--
2.7.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH -next] scsi: qla2xxx: use PTR_ERR_OR_ZERO() to simplify code
2020-01-22 10:18 [PATCH -next] scsi: qla2xxx: use " Chen Zhou
@ 2020-01-23 2:45 ` Bart Van Assche
0 siblings, 0 replies; 4+ messages in thread
From: Bart Van Assche @ 2020-01-23 2:45 UTC (permalink / raw)
To: Chen Zhou, hmadhani, jejb, martin.petersen; +Cc: linux-scsi, linux-kernel
On 2020-01-22 02:18, Chen Zhou wrote:
> PTR_ERR_OR_ZERO contains if(IS_ERR(...)) + PTR_ERR, just use
> PTR_ERR_OR_ZERO directly.
>
> Signed-off-by: Chen Zhou <chenzhou10@huawei.com>
> ---
> drivers/scsi/qla2xxx/tcm_qla2xxx.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/scsi/qla2xxx/tcm_qla2xxx.c b/drivers/scsi/qla2xxx/tcm_qla2xxx.c
> index abe7f79..719d53d 100644
> --- a/drivers/scsi/qla2xxx/tcm_qla2xxx.c
> +++ b/drivers/scsi/qla2xxx/tcm_qla2xxx.c
> @@ -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.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-05-06 15:42 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-06 7:54 [PATCH -next] scsi: qla2xxx: Use PTR_ERR_OR_ZERO() to simplify code Samuel Zou
2020-05-06 15:42 ` Bart Van Assche
-- strict thread matches above, loose matches on Subject: below --
2020-01-22 10:18 [PATCH -next] scsi: qla2xxx: use " Chen Zhou
2020-01-23 2:45 ` Bart Van Assche
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).