[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y2zII4SL4tlwfVi/@unreal>
Date: Thu, 10 Nov 2022 11:45:07 +0200
From: Leon Romanovsky <leon@...nel.org>
To: Zhengchao Shao <shaozhengchao@...wei.com>
Cc: netdev@...r.kernel.org, dchickles@...vell.com, sburla@...vell.com,
fmanlunas@...vell.com, davem@...emloft.net, edumazet@...gle.com,
kuba@...nel.org, pabeni@...hat.com, richardcochran@...il.com,
rvatsavayi@...iumnetworks.com, gregkh@...uxfoundation.org,
tseewald@...il.com, weiyongjun1@...wei.com, yuehaibing@...wei.com
Subject: Re: [PATCH net] net: liquidio: release resources when liquidio
driver open failed
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@...wei.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
Powered by blists - more mailing lists