LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] drivers/scsi: fix warning PTR_ERR_OR_ZERO can be used
@ 2019-05-25 9:42 Hariprasad Kelam
2019-05-26 15:37 ` Bart Van Assche
0 siblings, 1 reply; 2+ messages in thread
From: Hariprasad Kelam @ 2019-05-25 9:42 UTC (permalink / raw)
To: qla2xxx-upstream, James E.J. Bottomley, Martin K. Petersen,
Alim Akhtar, Avri Altman, Pedro Sousa, Wei Li, Geng Jianfeng,
Zang Leigang, Stanley Chu, Hariprasad Kelam,
Manivannan Sadhasivam, Kangjie Lu, Arnd Bergmann, linux-scsi,
linux-kernel
fix below warnig reported by coccicheck
/drivers/scsi/ufs/ufs-hisi.c:459:1-3: WARNING: PTR_ERR_OR_ZERO can be
used
./drivers/scsi/qla2xxx/tcm_qla2xxx.c:1477:1-3: WARNING: PTR_ERR_OR_ZERO
can be used
Signed-off-by: Hariprasad Kelam <hariprasad.kelam@gmail.com>
---
drivers/scsi/qla2xxx/tcm_qla2xxx.c | 4 +---
drivers/scsi/ufs/ufs-hisi.c | 4 +---
2 files changed, 2 insertions(+), 6 deletions(-)
diff --git a/drivers/scsi/qla2xxx/tcm_qla2xxx.c b/drivers/scsi/qla2xxx/tcm_qla2xxx.c
index ec9f199..4357b34 100644
--- a/drivers/scsi/qla2xxx/tcm_qla2xxx.c
+++ b/drivers/scsi/qla2xxx/tcm_qla2xxx.c
@@ -1474,10 +1474,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,
diff --git a/drivers/scsi/ufs/ufs-hisi.c b/drivers/scsi/ufs/ufs-hisi.c
index 7aed0a1..f506044 100644
--- a/drivers/scsi/ufs/ufs-hisi.c
+++ b/drivers/scsi/ufs/ufs-hisi.c
@@ -456,10 +456,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)
--
2.7.4
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] drivers/scsi: fix warning PTR_ERR_OR_ZERO can be used
2019-05-25 9:42 [PATCH] drivers/scsi: fix warning PTR_ERR_OR_ZERO can be used Hariprasad Kelam
@ 2019-05-26 15:37 ` Bart Van Assche
0 siblings, 0 replies; 2+ messages in thread
From: Bart Van Assche @ 2019-05-26 15:37 UTC (permalink / raw)
To: Hariprasad Kelam, qla2xxx-upstream, James E.J. Bottomley,
Martin K. Petersen, Alim Akhtar, Avri Altman, Pedro Sousa,
Wei Li, Geng Jianfeng, Zang Leigang, Stanley Chu,
Manivannan Sadhasivam, Kangjie Lu, Arnd Bergmann, linux-scsi,
linux-kernel
On 5/25/19 2:42 AM, Hariprasad Kelam wrote:
> fix below warnig reported by coccicheck
>
> /drivers/scsi/ufs/ufs-hisi.c:459:1-3: WARNING: PTR_ERR_OR_ZERO can be
> used
> ./drivers/scsi/qla2xxx/tcm_qla2xxx.c:1477:1-3: WARNING: PTR_ERR_OR_ZERO
> can be used
>
> Signed-off-by: Hariprasad Kelam <hariprasad.kelam@gmail.com>
> ---
> drivers/scsi/qla2xxx/tcm_qla2xxx.c | 4 +---
> drivers/scsi/ufs/ufs-hisi.c | 4 +---
> 2 files changed, 2 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/scsi/qla2xxx/tcm_qla2xxx.c b/drivers/scsi/qla2xxx/tcm_qla2xxx.c
> index ec9f199..4357b34 100644
> --- a/drivers/scsi/qla2xxx/tcm_qla2xxx.c
> +++ b/drivers/scsi/qla2xxx/tcm_qla2xxx.c
> @@ -1474,10 +1474,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,
> diff --git a/drivers/scsi/ufs/ufs-hisi.c b/drivers/scsi/ufs/ufs-hisi.c
> index 7aed0a1..f506044 100644
> --- a/drivers/scsi/ufs/ufs-hisi.c
> +++ b/drivers/scsi/ufs/ufs-hisi.c
> @@ -456,10 +456,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);
> }
Although I'm not sure this patch improves readability of the source code:
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-05-26 15:37 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-25 9:42 [PATCH] drivers/scsi: fix warning PTR_ERR_OR_ZERO can be used Hariprasad Kelam
2019-05-26 15:37 ` 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).