Commit b904aada authored by Parav Pandit's avatar Parav Pandit Committed by David S. Miller

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: default avatarParav Pandit <parav@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent cbd72b48
......@@ -5241,6 +5241,14 @@ EXPORT_SYMBOL_GPL(devlink_unregister);
*/
void devlink_free(struct devlink *devlink)
{
WARN_ON(!list_empty(&devlink->reporter_list));
WARN_ON(!list_empty(&devlink->region_list));
WARN_ON(!list_empty(&devlink->param_list));
WARN_ON(!list_empty(&devlink->resource_list));
WARN_ON(!list_empty(&devlink->dpipe_table_list));
WARN_ON(!list_empty(&devlink->sb_list));
WARN_ON(!list_empty(&devlink->port_list));
kfree(devlink);
}
EXPORT_SYMBOL_GPL(devlink_free);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment