lkml.org 
[lkml]   [2023]   [Mar]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] qlcnic: check pci_reset_function result
On Fri, Mar 31, 2023 at 11:06:05AM +0300, Denis Plotnikov wrote:
> Static code analyzer complains to unchecked return value.
> It seems that pci_reset_function return something meaningful
> only if "reset_methods" is set.
> Even if reset_methods isn't used check the return value to avoid
> possible bugs leading to undefined behavior in the future.
>
> Signed-off-by: Denis Plotnikov <den-plotnikov@yandex-team.ru>

nit: The tree this patch is targeted at should be designated, probably
net-next, so the '[PATCH net-next]' in the subject.

> ---
> drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c
> index 87f76bac2e463..39ecfc1a1dbd0 100644
> --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c
> +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c
> @@ -628,7 +628,9 @@ int qlcnic_fw_create_ctx(struct qlcnic_adapter *dev)
> int i, err, ring;
>
> if (dev->flags & QLCNIC_NEED_FLR) {
> - pci_reset_function(dev->pdev);
> + err = pci_reset_function(dev->pdev);
> + if (err && err != -ENOTTY)

Are you sure about the -ENOTTY part?

It seems odd to me that an FLR would be required but reset is not supported.

> + return err;
> dev->flags &= ~QLCNIC_NEED_FLR;
> }
>
> --
> 2.25.1
>

\
 
 \ /
  Last update: 2023-03-31 19:53    [W:0.063 / U:0.528 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site