Unregistering the wiphy removes its cw1200 debugfs directory. On SDIO unbind, cw1200_debug_release() then tries to remove the stale dentry. Leave directory removal to the wiphy and free the counters as before. Fixes: fa8eeae10257 ("cw1200: Remove "ITP" debug subsystem.") Signed-off-by: Arthur Heymans --- drivers/net/wireless/st/cw1200/debug.c | 19 ++++++++----------- drivers/net/wireless/st/cw1200/debug.h | 1 - 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/drivers/net/wireless/st/cw1200/debug.c b/drivers/net/wireless/st/cw1200/debug.c index 7dad6d3ba239..6b8b6ca35103 100644 --- a/drivers/net/wireless/st/cw1200/debug.c +++ b/drivers/net/wireless/st/cw1200/debug.c @@ -359,19 +359,20 @@ static const struct file_operations fops_wsm_dumps = { int cw1200_debug_init(struct cw1200_common *priv) { + struct dentry *dir; int ret = -ENOMEM; struct cw1200_debug_priv *d = kzalloc_obj(struct cw1200_debug_priv); priv->debug = d; if (!d) return ret; - d->debugfs_phy = debugfs_create_dir("cw1200", - priv->hw->wiphy->debugfsdir); - debugfs_create_file("status", 0400, d->debugfs_phy, priv, + /* wiphy_unregister() removes the whole subtree. */ + dir = debugfs_create_dir("cw1200", priv->hw->wiphy->debugfsdir); + debugfs_create_file("status", 0400, dir, priv, &cw1200_status_fops); - debugfs_create_file("counters", 0400, d->debugfs_phy, priv, + debugfs_create_file("counters", 0400, dir, priv, &cw1200_counters_fops); - debugfs_create_file("wsm_dumps", 0200, d->debugfs_phy, priv, + debugfs_create_file("wsm_dumps", 0200, dir, priv, &fops_wsm_dumps); return 0; @@ -379,10 +380,6 @@ int cw1200_debug_init(struct cw1200_common *priv) void cw1200_debug_release(struct cw1200_common *priv) { - struct cw1200_debug_priv *d = priv->debug; - if (d) { - debugfs_remove_recursive(d->debugfs_phy); - priv->debug = NULL; - kfree(d); - } + kfree(priv->debug); + priv->debug = NULL; } diff --git a/drivers/net/wireless/st/cw1200/debug.h b/drivers/net/wireless/st/cw1200/debug.h index 80bc1567533a..339a375b4c18 100644 --- a/drivers/net/wireless/st/cw1200/debug.h +++ b/drivers/net/wireless/st/cw1200/debug.h @@ -10,7 +10,6 @@ #define CW1200_DEBUG_H_INCLUDED struct cw1200_debug_priv { - struct dentry *debugfs_phy; int tx; int tx_agg; int rx; -- 2.56.0