forked from luck/tmp_suning_uos_patched
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@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
cbd72b4852
commit
b904aada80
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue
Block a user