2022-04-22 19:08:52

by Jakub Kicinski

[permalink] [raw]
Subject: Re: [PATCH] mediatek/mt7601u: add debugfs exit function

On Fri, 22 Apr 2022 10:45:57 +0300 Kalle Valo wrote:
> > When mt7601u loaded, there are two cases:
> > First when mt7601u is loaded, in function mt7601u_probe, if
> > function mt7601u_probe run into error lable err_hw,
> > mt7601u_cleanup didn`t cleanup the debugfs node.
> > Second when the module disconnect, in function mt7601u_disconnect,
> > mt7601u_cleanup didn`t cleanup the debugfs node.
> > This patch add debugfs exit function and try to cleanup debugfs
> > node when mt7601u loaded fail or unloaded.

Is this actually needed? Looks like wireless has a wiphy debugfs dir
now, so the entire thing should get removed recursively when probe
fails. The driver is not doing anything special.

> > diff --git a/drivers/net/wireless/mediatek/mt7601u/debugfs.c b/drivers/net/wireless/mediatek/mt7601u/debugfs.c
> > index 20669eacb66e..1ae3d75d3c9b 100644
> > --- a/drivers/net/wireless/mediatek/mt7601u/debugfs.c
> > +++ b/drivers/net/wireless/mediatek/mt7601u/debugfs.c
> > @@ -124,17 +124,22 @@ DEFINE_SHOW_ATTRIBUTE(mt7601u_eeprom_param);
> >
> > void mt7601u_init_debugfs(struct mt7601u_dev *dev)
> > {
> > - struct dentry *dir;
> > -
> > - dir = debugfs_create_dir("mt7601u", dev->hw->wiphy->debugfsdir);
> > - if (!dir)
> > + dev->root_dir = debugfs_create_dir("mt7601u", dev->hw->wiphy->debugfsdir);
> > + if (!dev->root_dir)
> > return;