* [PATCH] driver: nvme: fix missing error code
@ 2021-11-30 13:50 Dongliang Mu
2021-11-30 15:47 ` Keith Busch
0 siblings, 1 reply; 3+ messages in thread
From: Dongliang Mu @ 2021-11-30 13:50 UTC (permalink / raw)
To: Keith Busch, Jens Axboe, Christoph Hellwig, Sagi Grimberg
Cc: Dongliang Mu, linux-nvme, linux-kernel
Smatch reports:
drivers/nvme/host/multipath.c:865
nvme_mpath_init_identify() warn: missing error code 'error'
In one error handling path of nvme_mpath_init_identify(Line 865), error
is not initialized as an errno.
Fix this by assigning error to -EINVAL.
Signed-off-by: Dongliang Mu <mudongliangabcd@gmail.com>
---
drivers/nvme/host/multipath.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/nvme/host/multipath.c b/drivers/nvme/host/multipath.c
index 7f2071f2460c..2cbeb6d6b064 100644
--- a/drivers/nvme/host/multipath.c
+++ b/drivers/nvme/host/multipath.c
@@ -862,6 +862,7 @@ int nvme_mpath_init_identify(struct nvme_ctrl *ctrl, struct nvme_id_ctrl *id)
"ANA log page size (%zd) larger than MDTS (%zd).\n",
ana_log_size, max_transfer_size);
dev_err(ctrl->device, "disabling ANA support.\n");
+ error = -EINVAL;
goto out_uninit;
}
if (ana_log_size > ctrl->ana_log_size) {
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] driver: nvme: fix missing error code
2021-11-30 13:50 [PATCH] driver: nvme: fix missing error code Dongliang Mu
@ 2021-11-30 15:47 ` Keith Busch
2021-12-01 2:04 ` Dongliang Mu
0 siblings, 1 reply; 3+ messages in thread
From: Keith Busch @ 2021-11-30 15:47 UTC (permalink / raw)
To: Dongliang Mu
Cc: Jens Axboe, Christoph Hellwig, Sagi Grimberg, linux-nvme, linux-kernel
On Tue, Nov 30, 2021 at 09:50:14PM +0800, Dongliang Mu wrote:
> Smatch reports:
>
> drivers/nvme/host/multipath.c:865
> nvme_mpath_init_identify() warn: missing error code 'error'
>
> In one error handling path of nvme_mpath_init_identify(Line 865), error
> is not initialized as an errno.
>
> Fix this by assigning error to -EINVAL.
Nak, the code is correct as-is. Returning a negetive error will abort
the initialization process. We don't need ANA support in order to manage
this controller, so failing a controller for an optional condition
isn't helpful.
The other parts of this function returning negetive errors should be
fixed to return 0, though.
> Signed-off-by: Dongliang Mu <mudongliangabcd@gmail.com>
> ---
> drivers/nvme/host/multipath.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/nvme/host/multipath.c b/drivers/nvme/host/multipath.c
> index 7f2071f2460c..2cbeb6d6b064 100644
> --- a/drivers/nvme/host/multipath.c
> +++ b/drivers/nvme/host/multipath.c
> @@ -862,6 +862,7 @@ int nvme_mpath_init_identify(struct nvme_ctrl *ctrl, struct nvme_id_ctrl *id)
> "ANA log page size (%zd) larger than MDTS (%zd).\n",
> ana_log_size, max_transfer_size);
> dev_err(ctrl->device, "disabling ANA support.\n");
> + error = -EINVAL;
> goto out_uninit;
> }
> if (ana_log_size > ctrl->ana_log_size) {
> --
> 2.25.1
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] driver: nvme: fix missing error code
2021-11-30 15:47 ` Keith Busch
@ 2021-12-01 2:04 ` Dongliang Mu
0 siblings, 0 replies; 3+ messages in thread
From: Dongliang Mu @ 2021-12-01 2:04 UTC (permalink / raw)
To: Keith Busch
Cc: Jens Axboe, Christoph Hellwig, Sagi Grimberg, linux-nvme, linux-kernel
On Tue, Nov 30, 2021 at 11:48 PM Keith Busch <kbusch@kernel.org> wrote:
>
> On Tue, Nov 30, 2021 at 09:50:14PM +0800, Dongliang Mu wrote:
> > Smatch reports:
> >
> > drivers/nvme/host/multipath.c:865
> > nvme_mpath_init_identify() warn: missing error code 'error'
> >
> > In one error handling path of nvme_mpath_init_identify(Line 865), error
> > is not initialized as an errno.
> >
> > Fix this by assigning error to -EINVAL.
>
> Nak, the code is correct as-is. Returning a negetive error will abort
> the initialization process. We don't need ANA support in order to manage
> this controller, so failing a controller for an optional condition
> isn't helpful.
>
OK, I see. Let's ignore this patch.
> The other parts of this function returning negetive errors should be
> fixed to return 0, though.
Do I need to modify the error value to zero and submit another patch?
Or you will take care of it?
>
> > Signed-off-by: Dongliang Mu <mudongliangabcd@gmail.com>
> > ---
> > drivers/nvme/host/multipath.c | 1 +
> > 1 file changed, 1 insertion(+)
> >
> > diff --git a/drivers/nvme/host/multipath.c b/drivers/nvme/host/multipath.c
> > index 7f2071f2460c..2cbeb6d6b064 100644
> > --- a/drivers/nvme/host/multipath.c
> > +++ b/drivers/nvme/host/multipath.c
> > @@ -862,6 +862,7 @@ int nvme_mpath_init_identify(struct nvme_ctrl *ctrl, struct nvme_id_ctrl *id)
> > "ANA log page size (%zd) larger than MDTS (%zd).\n",
> > ana_log_size, max_transfer_size);
> > dev_err(ctrl->device, "disabling ANA support.\n");
> > + error = -EINVAL;
> > goto out_uninit;
> > }
> > if (ana_log_size > ctrl->ana_log_size) {
> > --
> > 2.25.1
> >
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-12-01 2:05 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-30 13:50 [PATCH] driver: nvme: fix missing error code Dongliang Mu
2021-11-30 15:47 ` Keith Busch
2021-12-01 2:04 ` Dongliang Mu
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).