[PATCH 5/5] nvme-fabrics: set ret to -ENODEV for error case

Sagi Grimberg sagi at grimberg.me
Tue Jan 18 22:26:06 PST 2022


>>> From: Chaitanya Kulkarni <kch at nvidia.com>
>>>
>>> In function nvmf_dev_show() if we don't find the controller set the
>>> ret variable to -ENODEV.
>>>
>>> Signed-off-by: Chaitanya Kulkarni <kch at nvidia.com>
>>> Suggested-by: Sagi Grimberg <sagi at grimberg.me>
>>> ---
>>>    drivers/nvme/host/fabrics.c | 1 +
>>>    1 file changed, 1 insertion(+)
>>>
>>> diff --git a/drivers/nvme/host/fabrics.c b/drivers/nvme/host/fabrics.c
>>> index df0326db306f..ca23ac926710 100644
>>> --- a/drivers/nvme/host/fabrics.c
>>> +++ b/drivers/nvme/host/fabrics.c
>>> @@ -1097,6 +1097,7 @@ static int nvmf_dev_show(struct seq_file *seq_file, void *private)
>>>         ctrl = seq_file->private;
>>>         if (!ctrl) {
>>>                 __nvmf_concat_opt_tokens(seq_file);
>>> +             ret = -ENODEV;
>>>                 goto out_unlock;
>>>         }
>>
>> I missed the discussion on this. Doesn't the __nvmf_concat_opt_tokens()
>> already return parameters that indicate to the caller that no controller
>> was found?
>>
> 
> The function I found in the repo returns nothing, is that the one you
> are referring to ?
> 
> static void __nvmf_concat_opt_tokens(struct seq_file *seq_file)

This is the path that Hannes added for userspace to detect kernel
capabilities. So probably its not appropriate to return an error
here, but rather take care of the original warning instead.



More information about the Linux-nvme mailing list