Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
From: Leon Romanovsky <leon@kernel.org>
To: Selvin Xavier <selvin.xavier@broadcom.com>
Cc: jgg@ziepe.ca, linux-rdma@vger.kernel.org,
	andrew.gospodarek@broadcom.com,
	kalesh-anakkur.purayil@broadcom.com
Subject: Re: [PATCH for-next 2/2] RDMA/bnxt_re: Allocate dev_attr information dynamically
Date: Tue, 14 Jan 2025 13:25:55 +0200	[thread overview]
Message-ID: <20250114112555.GG3146852@unreal> (raw)
In-Reply-To: <1736446693-6692-3-git-send-email-selvin.xavier@broadcom.com>

On Thu, Jan 09, 2025 at 10:18:13AM -0800, Selvin Xavier wrote:
> From: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
> 
> In order to optimize the size of driver private structure,
> the memory for dev_attr is allocated dynamically during the
> chip context initialization. In order to make certain runtime
> decisions, store dev_attr in the qplib_res structure.
> 
> Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
> Signed-off-by: Selvin Xavier <selvin.xavier@broadcom.com>
> ---
>  drivers/infiniband/hw/bnxt_re/bnxt_re.h     |  2 +-
>  drivers/infiniband/hw/bnxt_re/hw_counters.c |  2 +-
>  drivers/infiniband/hw/bnxt_re/ib_verbs.c    | 38 ++++++++++++++---------------
>  drivers/infiniband/hw/bnxt_re/main.c        | 36 +++++++++++++++++----------
>  drivers/infiniband/hw/bnxt_re/qplib_res.c   |  7 +++---
>  drivers/infiniband/hw/bnxt_re/qplib_res.h   |  4 +--
>  drivers/infiniband/hw/bnxt_re/qplib_sp.c    |  4 +--
>  drivers/infiniband/hw/bnxt_re/qplib_sp.h    |  3 +--
>  8 files changed, 51 insertions(+), 45 deletions(-)

<...>

> index 33956fc..7c7057b 100644
> --- a/drivers/infiniband/hw/bnxt_re/main.c
> +++ b/drivers/infiniband/hw/bnxt_re/main.c
> @@ -148,6 +148,10 @@ static void bnxt_re_destroy_chip_ctx(struct bnxt_re_dev *rdev)
>  
>  	if (!rdev->chip_ctx)
>  		return;
> +
> +	kfree(rdev->dev_attr);
> +	rdev->dev_attr = NULL;
> +

I'm taking this patch, but please let's stop this practice of setting NULL
for the pointers which are not going to be reused. Such assignment hides bugs.

Thanks

  reply	other threads:[~2025-01-14 11:26 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-09 18:18 [PATCH for-next 0/2] RDMA/bnxt_re: Driver update Selvin Xavier
2025-01-09 18:18 ` [PATCH for-next 1/2] RDMA/bnxt_re: Pass the context for ulp_irq_stop Selvin Xavier
2025-01-09 18:18 ` [PATCH for-next 2/2] RDMA/bnxt_re: Allocate dev_attr information dynamically Selvin Xavier
2025-01-14 11:25   ` Leon Romanovsky [this message]
2025-01-15  4:03     ` Kalesh Anakkur Purayil
2025-01-14 11:26 ` [PATCH for-next 0/2] RDMA/bnxt_re: Driver update Leon Romanovsky

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=20250114112555.GG3146852@unreal \
    --to=leon@kernel.org \
    --cc=andrew.gospodarek@broadcom.com \
    --cc=jgg@ziepe.ca \
    --cc=kalesh-anakkur.purayil@broadcom.com \
    --cc=linux-rdma@vger.kernel.org \
    --cc=selvin.xavier@broadcom.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox