* [PATCH] scsi: qla2xxx: Re-use existing error handling path
@ 2021-04-11 9:21 Christophe JAILLET
2021-04-11 15:58 ` Bart Van Assche
2021-04-16 2:51 ` Martin K. Petersen
0 siblings, 2 replies; 3+ messages in thread
From: Christophe JAILLET @ 2021-04-11 9:21 UTC (permalink / raw)
To: njavali, GR-QLogic-Storage-Upstream, jejb, martin.petersen
Cc: linux-scsi, linux-kernel, kernel-janitors, Christophe JAILLET
There is no need to duplicate some code, use the existing error handling
path to free some resources.
This is more future-proof.
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
The code above this hunk looks spurious to me.
It looks like an error handling path (i.e.
"if (response_len > bsg_job->reply_payload.payload_len)")
but returns 0, which is the initial value of 'ret'.
Shouldn't we have ret = -<something> here?
---
drivers/scsi/qla2xxx/qla_bsg.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/scsi/qla2xxx/qla_bsg.c b/drivers/scsi/qla2xxx/qla_bsg.c
index aef2f7cc89d3..d42b2ad84049 100644
--- a/drivers/scsi/qla2xxx/qla_bsg.c
+++ b/drivers/scsi/qla2xxx/qla_bsg.c
@@ -2585,8 +2585,8 @@ qla2x00_get_host_stats(struct bsg_job *bsg_job)
data = kzalloc(response_len, GFP_KERNEL);
if (!data) {
- kfree(req_data);
- return -ENOMEM;
+ ret = -ENOMEM;
+ goto host_stat_out;
}
ret = qla2xxx_get_ini_stats(fc_bsg_to_shost(bsg_job), req_data->stat_type,
--
2.27.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] scsi: qla2xxx: Re-use existing error handling path
2021-04-11 9:21 [PATCH] scsi: qla2xxx: Re-use existing error handling path Christophe JAILLET
@ 2021-04-11 15:58 ` Bart Van Assche
2021-04-16 2:51 ` Martin K. Petersen
1 sibling, 0 replies; 3+ messages in thread
From: Bart Van Assche @ 2021-04-11 15:58 UTC (permalink / raw)
To: Christophe JAILLET, njavali, GR-QLogic-Storage-Upstream, jejb,
martin.petersen
Cc: linux-scsi, linux-kernel, kernel-janitors
On 4/11/21 2:21 AM, Christophe JAILLET wrote:
> The code above this hunk looks spurious to me.
>
> It looks like an error handling path (i.e.
> "if (response_len > bsg_job->reply_payload.payload_len)")
> but returns 0, which is the initial value of 'ret'.
>
> Shouldn't we have ret = -<something> here?
Hmm ... if I read that code path correctly it is on purpose that that
code path returns 0 and error reporting happens by reporting the
EXT_STATUS_BUFFER_TOO_SMALL error code to user space.
> ---
> drivers/scsi/qla2xxx/qla_bsg.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/scsi/qla2xxx/qla_bsg.c b/drivers/scsi/qla2xxx/qla_bsg.c
> index aef2f7cc89d3..d42b2ad84049 100644
> --- a/drivers/scsi/qla2xxx/qla_bsg.c
> +++ b/drivers/scsi/qla2xxx/qla_bsg.c
> @@ -2585,8 +2585,8 @@ qla2x00_get_host_stats(struct bsg_job *bsg_job)
>
> data = kzalloc(response_len, GFP_KERNEL);
> if (!data) {
> - kfree(req_data);
> - return -ENOMEM;
> + ret = -ENOMEM;
> + goto host_stat_out;
> }
>
> ret = qla2xxx_get_ini_stats(fc_bsg_to_shost(bsg_job), req_data->stat_type,
Since the above looks good to me:
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] scsi: qla2xxx: Re-use existing error handling path
2021-04-11 9:21 [PATCH] scsi: qla2xxx: Re-use existing error handling path Christophe JAILLET
2021-04-11 15:58 ` Bart Van Assche
@ 2021-04-16 2:51 ` Martin K. Petersen
1 sibling, 0 replies; 3+ messages in thread
From: Martin K. Petersen @ 2021-04-16 2:51 UTC (permalink / raw)
To: jejb, njavali, Christophe JAILLET, GR-QLogic-Storage-Upstream
Cc: Martin K . Petersen, linux-kernel, kernel-janitors, linux-scsi
On Sun, 11 Apr 2021 11:21:40 +0200, Christophe JAILLET wrote:
> There is no need to duplicate some code, use the existing error handling
> path to free some resources.
> This is more future-proof.
Applied to 5.13/scsi-queue, thanks!
[1/1] scsi: qla2xxx: Re-use existing error handling path
https://git.kernel.org/mkp/scsi/c/5dc3468888f8
--
Martin K. Petersen Oracle Linux Engineering
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-04-16 2:51 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-11 9:21 [PATCH] scsi: qla2xxx: Re-use existing error handling path Christophe JAILLET
2021-04-11 15:58 ` Bart Van Assche
2021-04-16 2:51 ` Martin K. Petersen
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).