diff options
author | Parav Pandit <parav@mellanox.com> | 2019-02-08 22:15:00 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2019-02-11 22:21:25 +0100 |
commit | b904aada8033749558e3aaeb574a2200bf0458f0 (patch) | |
tree | 5bae307e117c65fe6fbb5a5b34c1afca1ee92181 /net/core/devlink.c | |
parent | net: dsa: microchip: add switch offload forwarding support (diff) | |
download | linux-b904aada8033749558e3aaeb574a2200bf0458f0.tar.xz linux-b904aada8033749558e3aaeb574a2200bf0458f0.zip |
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>
Diffstat (limited to 'net/core/devlink.c')
-rw-r--r-- | net/core/devlink.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/net/core/devlink.c b/net/core/devlink.c index e6a015b8ac9b..0de1edb65c24 100644 --- a/net/core/devlink.c +++ b/net/core/devlink.c @@ -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); |