All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kalle Valo <quic_kvalo@quicinc.com>
To: Dan Carpenter <error27@gmail.com>
Cc: <oe-kbuild@lists.linux.dev>, <lkp@intel.com>,
	<oe-kbuild-all@lists.linux.dev>, <linux-kernel@vger.kernel.org>,
	<ath11k@lists.infradead.org>
Subject: Re: drivers/net/wireless/ath/ath11k/debugfs.c:1009 ath11k_debugfs_soc_create() warn: passing zero to 'PTR_ERR'
Date: Mon, 17 Apr 2023 17:42:38 +0300	[thread overview]
Message-ID: <87o7nm4lk1.fsf@kvalo10.eu.qualcomm.com> (raw)
In-Reply-To: <278dae1d-0cc2-4963-b7f0-5d611a5b31a4@kili.mountain> (Dan Carpenter's message of "Sat, 15 Apr 2023 16:15:07 +0300")

+ 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  }

-- 
ath11k mailing list
ath11k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath11k

WARNING: multiple messages have this Message-ID (diff)
From: Kalle Valo <quic_kvalo@quicinc.com>
To: Dan Carpenter <error27@gmail.com>
Cc: <oe-kbuild@lists.linux.dev>, <lkp@intel.com>,
	<oe-kbuild-all@lists.linux.dev>, <linux-kernel@vger.kernel.org>,
	<ath11k@lists.infradead.org>
Subject: Re: drivers/net/wireless/ath/ath11k/debugfs.c:1009 ath11k_debugfs_soc_create() warn: passing zero to 'PTR_ERR'
Date: Mon, 17 Apr 2023 17:42:38 +0300	[thread overview]
Message-ID: <87o7nm4lk1.fsf@kvalo10.eu.qualcomm.com> (raw)
In-Reply-To: <278dae1d-0cc2-4963-b7f0-5d611a5b31a4@kili.mountain> (Dan Carpenter's message of "Sat, 15 Apr 2023 16:15:07 +0300")

+ 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  }

  reply	other threads:[~2023-04-17 14:42 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]
2023-04-17 14:42   ` Kalle Valo
  -- strict thread matches above, loose matches on Subject: below --
2023-05-08  5:00 kernel test robot
2023-04-15 13:10 kernel test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87o7nm4lk1.fsf@kvalo10.eu.qualcomm.com \
    --to=quic_kvalo@quicinc.com \
    --cc=ath11k@lists.infradead.org \
    --cc=error27@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=oe-kbuild@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.