mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* drivers/net/wireless/ath/ath11k/debugfs.c:1009 ath11k_debugfs_soc_create() warn: passing zero to 'PTR_ERR'
@ 2023-04-15 13:15 Dan Carpenter
  2023-04-17 14:42 ` Kalle Valo
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2023-04-15 13:15 UTC (permalink / raw)
  To: oe-kbuild, Kalle Valo; +Cc: lkp, oe-kbuild-all, linux-kernel

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@intel.com>
| Reported-by: Dan Carpenter <error27@gmail.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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: drivers/net/wireless/ath/ath11k/debugfs.c:1009 ath11k_debugfs_soc_create() warn: passing zero to 'PTR_ERR'
  2023-04-15 13:15 drivers/net/wireless/ath/ath11k/debugfs.c:1009 ath11k_debugfs_soc_create() warn: passing zero to 'PTR_ERR' Dan Carpenter
@ 2023-04-17 14:42 ` Kalle Valo
  0 siblings, 0 replies; 2+ messages in thread
From: Kalle Valo @ 2023-04-17 14:42 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: oe-kbuild, lkp, oe-kbuild-all, linux-kernel, ath11k

+ ath11k list

Including the full report below.

Kalle

Dan Carpenter <error27@gmail.com> writes:

> 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@intel.com>
> | Reported-by: Dan Carpenter <error27@gmail.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  }

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-04-17 14:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-15 13:15 drivers/net/wireless/ath/ath11k/debugfs.c:1009 ath11k_debugfs_soc_create() warn: passing zero to 'PTR_ERR' Dan Carpenter
2023-04-17 14:42 ` Kalle Valo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®