[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <278dae1d-0cc2-4963-b7f0-5d611a5b31a4@kili.mountain>
Date: Sat, 15 Apr 2023 16:15:07 +0300
From: Dan Carpenter <error27@...il.com>
To: oe-kbuild@...ts.linux.dev, Kalle Valo <quic_kvalo@...cinc.com>
Cc: lkp@...el.com, oe-kbuild-all@...ts.linux.dev,
linux-kernel@...r.kernel.org
Subject: drivers/net/wireless/ath/ath11k/debugfs.c:1009
ath11k_debugfs_soc_create() warn: passing zero to 'PTR_ERR'
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 7a934f4bd7d6f9da84c8812da3ba42ee10f5778e
commit: 323d91d4684d238f6bc3693fed93caf795378fe0 wifi: ath11k: debugfs: fix to work with multiple PCI devices
config: openrisc-randconfig-m041-20230414 (https://download.01.org/0day-ci/archive/20230415/202304152142.ssXYxFdQ-lkp@intel.com/config)
compiler: or1k-linux-gcc (GCC) 12.1.0
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@...el.com>
| Reported-by: Dan Carpenter <error27@...il.com>
| Link: https://lore.kernel.org/r/202304152142.ssXYxFdQ-lkp@intel.com/
New smatch warnings:
drivers/net/wireless/ath/ath11k/debugfs.c:1009 ath11k_debugfs_soc_create() warn: passing zero to 'PTR_ERR'
Old smatch warnings:
drivers/net/wireless/ath/ath11k/debugfs.c:1022 ath11k_debugfs_soc_create() warn: passing zero to 'PTR_ERR'
vim +/PTR_ERR +1009 drivers/net/wireless/ath/ath11k/debugfs.c
cb4e57db2ff0c8 Kalle Valo 2020-09-16 998 int ath11k_debugfs_soc_create(struct ath11k_base *ab)
da3a9d3c15769b Kalle Valo 2020-09-16 999 {
323d91d4684d23 Kalle Valo 2022-12-22 1000 struct dentry *root;
323d91d4684d23 Kalle Valo 2022-12-22 1001 bool dput_needed;
323d91d4684d23 Kalle Valo 2022-12-22 1002 char name[64];
323d91d4684d23 Kalle Valo 2022-12-22 1003 int ret;
323d91d4684d23 Kalle Valo 2022-12-22 1004
323d91d4684d23 Kalle Valo 2022-12-22 1005 root = debugfs_lookup("ath11k", NULL);
323d91d4684d23 Kalle Valo 2022-12-22 1006 if (!root) {
323d91d4684d23 Kalle Valo 2022-12-22 1007 root = debugfs_create_dir("ath11k", NULL);
323d91d4684d23 Kalle Valo 2022-12-22 1008 if (IS_ERR_OR_NULL(root))
323d91d4684d23 Kalle Valo 2022-12-22 @1009 return PTR_ERR(root);
Debugfs used to return a mix of error pointers and NULL but we changed
the NULL return to an error pointer to encourage people to just delete
all debugfs error handling code.
323d91d4684d23 Kalle Valo 2022-12-22 1010
323d91d4684d23 Kalle Valo 2022-12-22 1011 dput_needed = false;
323d91d4684d23 Kalle Valo 2022-12-22 1012 } else {
323d91d4684d23 Kalle Valo 2022-12-22 1013 /* a dentry from lookup() needs dput() after we don't use it */
323d91d4684d23 Kalle Valo 2022-12-22 1014 dput_needed = true;
323d91d4684d23 Kalle Valo 2022-12-22 1015 }
323d91d4684d23 Kalle Valo 2022-12-22 1016
323d91d4684d23 Kalle Valo 2022-12-22 1017 scnprintf(name, sizeof(name), "%s-%s", ath11k_bus_str(ab->hif.bus),
323d91d4684d23 Kalle Valo 2022-12-22 1018 dev_name(ab->dev));
da3a9d3c15769b Kalle Valo 2020-09-16 1019
323d91d4684d23 Kalle Valo 2022-12-22 1020 ab->debugfs_soc = debugfs_create_dir(name, root);
323d91d4684d23 Kalle Valo 2022-12-22 1021 if (IS_ERR_OR_NULL(ab->debugfs_soc)) {
323d91d4684d23 Kalle Valo 2022-12-22 1022 ret = PTR_ERR(ab->debugfs_soc);
323d91d4684d23 Kalle Valo 2022-12-22 1023 goto out;
323d91d4684d23 Kalle Valo 2022-12-22 1024 }
323d91d4684d23 Kalle Valo 2022-12-22 1025
323d91d4684d23 Kalle Valo 2022-12-22 1026 ret = 0;
323d91d4684d23 Kalle Valo 2022-12-22 1027
323d91d4684d23 Kalle Valo 2022-12-22 1028 out:
323d91d4684d23 Kalle Valo 2022-12-22 1029 if (dput_needed)
323d91d4684d23 Kalle Valo 2022-12-22 1030 dput(root);
323d91d4684d23 Kalle Valo 2022-12-22 1031
323d91d4684d23 Kalle Valo 2022-12-22 1032 return ret;
da3a9d3c15769b Kalle Valo 2020-09-16 1033 }
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests
Powered by blists - more mailing lists