Messages in this thread | | | Date | Fri, 23 Dec 2022 19:21:49 +0300 | From | Dan Carpenter <> | Subject | Re: drivers/nvme/host/auth.c:950 nvme_auth_init_ctrl() warn: missing error code? 'ret' |
| |
On Fri, Dec 23, 2022 at 04:47:54PM +0100, Christoph Hellwig wrote: > diff --git a/drivers/nvme/host/auth.c b/drivers/nvme/host/auth.c > index bb0abbe4491cdc..c808652966a94f 100644 > --- a/drivers/nvme/host/auth.c > +++ b/drivers/nvme/host/auth.c > @@ -943,16 +943,19 @@ int nvme_auth_init_ctrl(struct nvme_ctrl *ctrl) > INIT_WORK(&ctrl->dhchap_auth_work, nvme_ctrl_auth_work); > if (!ctrl->opts) > return 0; > - ret = nvme_auth_generate_key(ctrl->opts->dhchap_secret, > - &ctrl->host_key); > - if (ret) > - return ret; > - ret = nvme_auth_generate_key(ctrl->opts->dhchap_ctrl_secret, > - &ctrl->ctrl_key); > - if (ret) > + > + ctrl->host_key = nvme_auth_generate_key(ctrl->opts->dhchap_secret); > + if (IS_ERR(ctrl->host_key)) { > + ret = PTR_ERR(ctrl->host_key); > + goto out; > + } > + ctrl->ctrl_key = nvme_auth_generate_key(ctrl->opts->dhchap_ctrl_secret); > + if (IS_ERR(ctrl->ctrl_key)) { > + ret = PTR_ERR(ctrl->ctrl_key); > goto err_free_dhchap_secret; > + } > > - if (!ctrl->opts->dhchap_secret && !ctrl->opts->dhchap_ctrl_secret) > + if (!ctrl->host_key && !ctrl->ctrl_key) > return ret;
ret is uninitialized now.
regards, dan carpenter
| |