mbox series

[net,0/3] wifi: Fix the NULL vs IS_ERR() bugs for debugfs_create_dir()

Message ID 20230831141347.3166988-1-ruanjinjie@huawei.com (mailing list archive)
Headers show
Series wifi: Fix the NULL vs IS_ERR() bugs for debugfs_create_dir() | expand

Message

Jinjie Ruan Aug. 31, 2023, 2:13 p.m. UTC
Since debugfs_create_dir() returns ERR_PTR and never return NULL, So use
IS_ERR() to check it instead of checking NULL.

Jinjie Ruan (3):
  wifi: iwlwifi: mei: Fix the NULL vs IS_ERR() bug for
    debugfs_create_dir()
  mwifiex: debugfs: Fix the NULL vs IS_ERR() bug for
    debugfs_create_dir()
  wifi: mt76: Fix the NULL vs IS_ERR() bug for debugfs_create_dir()

 drivers/net/wireless/intel/iwlwifi/mei/main.c  | 2 +-
 drivers/net/wireless/marvell/mwifiex/debugfs.c | 2 +-
 drivers/net/wireless/mediatek/mt76/debugfs.c   | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

Comments

Russell King (Oracle) Aug. 31, 2023, 2:17 p.m. UTC | #1
On Thu, Aug 31, 2023 at 10:13:44PM +0800, Jinjie Ruan wrote:
> Since debugfs_create_dir() returns ERR_PTR and never return NULL, So use
> IS_ERR() to check it instead of checking NULL.

It is preferred that the return value from debugfs functions is _not_
checked.

See for example:

https://lore.kernel.org/linux-arm-kernel/20180601111004.1670-3-gregkh@linuxfoundation.org/T/

Thanks.
Kalle Valo Aug. 31, 2023, 3:27 p.m. UTC | #2
Jinjie Ruan <ruanjinjie@huawei.com> writes:

> Since debugfs_create_dir() returns ERR_PTR and never return NULL, So use
> IS_ERR() to check it instead of checking NULL.
>
> Jinjie Ruan (3):
>   wifi: iwlwifi: mei: Fix the NULL vs IS_ERR() bug for
>     debugfs_create_dir()
>   mwifiex: debugfs: Fix the NULL vs IS_ERR() bug for
>     debugfs_create_dir()
>   wifi: mt76: Fix the NULL vs IS_ERR() bug for debugfs_create_dir()
>
>  drivers/net/wireless/intel/iwlwifi/mei/main.c  | 2 +-
>  drivers/net/wireless/marvell/mwifiex/debugfs.c | 2 +-
>  drivers/net/wireless/mediatek/mt76/debugfs.c   | 2 +-
>  3 files changed, 3 insertions(+), 3 deletions(-)

Wireless patches go wireless-next tree, not net tree.