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 <pa...@mellanox.com>
> Acked-by: Jiri Pirko <j...@mellanox.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.

Reply via email to