From: Leon Romanovsky <leon@kernel.org>
To: Zhengchao Shao <shaozhengchao@huawei.com>
Cc: netdev@vger.kernel.org, dchickles@marvell.com,
sburla@marvell.com, fmanlunas@marvell.com, davem@davemloft.net,
edumazet@google.com, kuba@kernel.org, pabeni@redhat.com,
richardcochran@gmail.com, rvatsavayi@caviumnetworks.com,
gregkh@linuxfoundation.org, tseewald@gmail.com,
weiyongjun1@huawei.com, yuehaibing@huawei.com
Subject: Re: [PATCH net] net: liquidio: release resources when liquidio driver open failed
Date: Thu, 10 Nov 2022 11:45:07 +0200 [thread overview]
Message-ID: <Y2zII4SL4tlwfVi/@unreal> (raw)
In-Reply-To: <20221110013116.270258-1-shaozhengchao@huawei.com>
On Thu, Nov 10, 2022 at 09:31:16AM +0800, Zhengchao Shao wrote:
> When liquidio driver open failed, it doesn't release resources. Compile
> tested only.
>
> Fixes: 5b07aee11227 ("liquidio: MSIX support for CN23XX")
> Fixes: dbc97bfd3918 ("net: liquidio: Add missing null pointer checks")
> Signed-off-by: Zhengchao Shao <shaozhengchao@huawei.com>
> ---
> .../net/ethernet/cavium/liquidio/lio_main.c | 40 ++++++++++++++++---
> 1 file changed, 34 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/net/ethernet/cavium/liquidio/lio_main.c b/drivers/net/ethernet/cavium/liquidio/lio_main.c
> index d312bd594935..713689cf212c 100644
> --- a/drivers/net/ethernet/cavium/liquidio/lio_main.c
> +++ b/drivers/net/ethernet/cavium/liquidio/lio_main.c
> @@ -1795,12 +1795,15 @@ static int liquidio_open(struct net_device *netdev)
> ifstate_set(lio, LIO_IFSTATE_RUNNING);
>
> if (OCTEON_CN23XX_PF(oct)) {
> - if (!oct->msix_on)
> - if (setup_tx_poll_fn(netdev))
> - return -1;
> + if (!oct->msix_on) {
> + ret = setup_tx_poll_fn(netdev);
> + if (ret)
> + goto err_poll;
> + }
> } else {
> - if (setup_tx_poll_fn(netdev))
> - return -1;
> + ret = setup_tx_poll_fn(netdev);
> + if (ret)
> + goto err_poll;
> }
Instead of this hairy code, you can squeeze everything into one if:
if (!OCTEON_CN23XX_PF(oct) || (OCTEON_CN23XX_PF(oct) && oct->msix_on)) {
ret = setup_tx_poll_fn(netdev);
if (ret)
,,,
Thanks
next prev parent reply other threads:[~2022-11-10 9:45 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-10 1:31 [PATCH net] net: liquidio: release resources when liquidio driver open failed Zhengchao Shao
2022-11-10 9:45 ` Leon Romanovsky [this message]
2022-11-10 10:04 ` shaozhengchao
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Y2zII4SL4tlwfVi/@unreal \
--to=leon@kernel.org \
--cc=davem@davemloft.net \
--cc=dchickles@marvell.com \
--cc=edumazet@google.com \
--cc=fmanlunas@marvell.com \
--cc=gregkh@linuxfoundation.org \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=richardcochran@gmail.com \
--cc=rvatsavayi@caviumnetworks.com \
--cc=sburla@marvell.com \
--cc=shaozhengchao@huawei.com \
--cc=tseewald@gmail.com \
--cc=weiyongjun1@huawei.com \
--cc=yuehaibing@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.