[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1549642921-11196-1-git-send-email-parav@mellanox.com>
Date: Fri, 8 Feb 2019 10:22:01 -0600
From: Parav Pandit <parav@...lanox.com>
To: netdev@...r.kernel.org, davem@...emloft.net
Cc: parav@...lanox.com
Subject: [PATCH net-next] devlink: Add WARN_ON to catch errors of not cleaning devlink objects
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);
--
1.8.3.1
Powered by blists - more mailing lists