On Thu, Jan 09, 2025 at 10:18:13AM -0800, Selvin Xavier wrote: > From: Kalesh AP <kalesh-anakkur.purayil@xxxxxxxxxxxx> > > 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@xxxxxxxxxxxx> > Signed-off-by: Selvin Xavier <selvin.xavier@xxxxxxxxxxxx> > --- > 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