Re: [PATCH for-next 2/2] RDMA/bnxt_re: Allocate dev_attr information dynamically

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jan 14, 2025 at 4:56 PM Leon Romanovsky <leon@xxxxxxxxxx> wrote:
>
> 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.

Sure, we will try to remove such occurrences in the driver and push a
cleanup patch. Thanks!
>
> Thanks



-- 
Regards,
Kalesh AP

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature


[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux