[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <VI1PR0501MB2271230158058746713392C0D1690@VI1PR0501MB2271.eurprd05.prod.outlook.com>
Date: Fri, 8 Feb 2019 18:01:02 +0000
From: Parav Pandit <parav@...lanox.com>
To: David Ahern <dsahern@...il.com>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"davem@...emloft.net" <davem@...emloft.net>
Subject: RE: [PATCH net-next] devlink: Add WARN_ON to catch errors of not
cleaning devlink objects
> -----Original Message-----
> From: David Ahern <dsahern@...il.com>
> Sent: Friday, February 8, 2019 11:30 AM
> To: Parav Pandit <parav@...lanox.com>; netdev@...r.kernel.org;
> davem@...emloft.net
> Subject: Re: [PATCH net-next] devlink: Add WARN_ON to catch errors of not
> cleaning devlink objects
>
> On 2/8/19 8:22 AM, Parav Pandit wrote:
> > Add WARN_ON to make sure that all sub objects of a devlink device are
> > cleanedup before freeing the devlink device.
> > This helps to catch any driver bugs.
> >
> > Signed-off-by: Parav Pandit <parav@...lanox.com>
> > Acked-by: Jiri Pirko <jiri@...lanox.com>
> > ---
> > net/core/devlink.c | 7 +++++++
> > 1 file changed, 7 insertions(+)
> >
> > diff --git a/net/core/devlink.c b/net/core/devlink.c index
> > cd0d393..5e2ef5a 100644
> > --- a/net/core/devlink.c
> > +++ b/net/core/devlink.c
> > @@ -4229,6 +4229,13 @@ void devlink_unregister(struct devlink *devlink)
> > */
> > void devlink_free(struct devlink *devlink) {
> > + WARN_ON(!list_empty(&devlink->port_list));
> > + WARN_ON(!list_empty(&devlink->sb_list));
> > + WARN_ON(!list_empty(&devlink->dpipe_table_list));
> > + WARN_ON(!list_empty(&devlink->resource_list));
> > + WARN_ON(!list_empty(&devlink->param_list));
> > + WARN_ON(!list_empty(&devlink->region_list));
> > +
> > kfree(devlink);
> > }
> > EXPORT_SYMBOL_GPL(devlink_free);
> >
>
> reporter_list was just added which brings up the maintenance question:
> If you are going to do this you might want a comment in
> include/net/devlink.h to remind folks to update this function as relevant.
I see. Make sense. Adding reporter_list and updating devlink.h, too for comment in v1.
Powered by blists - more mailing lists