All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: oe-kbuild@lists.linux.dev
Cc: lkp@intel.com, Julia Lawall <julia.lawall@inria.fr>
Subject: [rafael-pm:thermal-core-testing 14/18] drivers/thermal/thermal_of.c:323:3-14: ERROR: probable double put.
Date: Sat, 17 Aug 2024 21:19:16 +0800	[thread overview]
Message-ID: <202408172115.o4q95c8X-lkp@intel.com> (raw)

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
CC: linux-acpi@vger.kernel.org
CC: devel@acpica.org
CC: linux-pm@vger.kernel.org
TO: "Rafael J. Wysocki" <rjw@rjwysocki.net>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git thermal-core-testing
head:   7614833c510a4fa9b8567097aac91c71d38b3fa7
commit: d67921b3a07428696ab6d91d3c027b1c7afbca85 [14/18] thermal/of: Use the .should_bind() thermal zone callback
:::::: branch date: 26 hours ago
:::::: commit date: 26 hours ago
config: i386-randconfig-053-20240817 (https://download.01.org/0day-ci/archive/20240817/202408172115.o4q95c8X-lkp@intel.com/config)
compiler: clang version 18.1.5 (https://github.com/llvm/llvm-project 617a15a9eac96088ae5e9134248d8236e34b91b1)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Julia Lawall <julia.lawall@inria.fr>
| Closes: https://lore.kernel.org/r/202408172115.o4q95c8X-lkp@intel.com/

cocci warnings: (new ones prefixed by >>)
>> drivers/thermal/thermal_of.c:323:3-14: ERROR: probable double put.

vim +323 drivers/thermal/thermal_of.c

3fd6d6e2b4e80fe Daniel Lezcano    2022-08-05  297  
d67921b3a074286 Rafael J. Wysocki 2024-07-31  298  static bool thermal_of_should_bind(struct thermal_zone_device *tz,
d67921b3a074286 Rafael J. Wysocki 2024-07-31  299  				   const struct thermal_trip *trip,
3fd6d6e2b4e80fe Daniel Lezcano    2022-08-05  300  				   struct thermal_cooling_device *cdev,
d67921b3a074286 Rafael J. Wysocki 2024-07-31  301  				   struct cooling_spec *c)
3fd6d6e2b4e80fe Daniel Lezcano    2022-08-05  302  {
3fd6d6e2b4e80fe Daniel Lezcano    2022-08-05  303  	struct device_node *tz_np, *cm_np, *child;
d67921b3a074286 Rafael J. Wysocki 2024-07-31  304  	bool result = false;
3fd6d6e2b4e80fe Daniel Lezcano    2022-08-05  305  
3fd6d6e2b4e80fe Daniel Lezcano    2022-08-05  306  	tz_np = thermal_of_zone_get_by_name(tz);
3fd6d6e2b4e80fe Daniel Lezcano    2022-08-05  307  	if (IS_ERR(tz_np)) {
3fd6d6e2b4e80fe Daniel Lezcano    2022-08-05  308  		pr_err("Failed to get node tz by name\n");
d67921b3a074286 Rafael J. Wysocki 2024-07-31  309  		return false;
3fd6d6e2b4e80fe Daniel Lezcano    2022-08-05  310  	}
3fd6d6e2b4e80fe Daniel Lezcano    2022-08-05  311  
3fd6d6e2b4e80fe Daniel Lezcano    2022-08-05  312  	cm_np = of_get_child_by_name(tz_np, "cooling-maps");
3fd6d6e2b4e80fe Daniel Lezcano    2022-08-05  313  	if (!cm_np)
3fd6d6e2b4e80fe Daniel Lezcano    2022-08-05  314  		goto out;
3fd6d6e2b4e80fe Daniel Lezcano    2022-08-05  315  
d67921b3a074286 Rafael J. Wysocki 2024-07-31  316  	/* Look up the trip and the cdev in the cooling maps. */
3fd6d6e2b4e80fe Daniel Lezcano    2022-08-05  317  	for_each_child_of_node(cm_np, child) {
d67921b3a074286 Rafael J. Wysocki 2024-07-31  318  		struct device_node *tr_np;
d67921b3a074286 Rafael J. Wysocki 2024-07-31  319  		int count, i;
d67921b3a074286 Rafael J. Wysocki 2024-07-31  320  
d67921b3a074286 Rafael J. Wysocki 2024-07-31  321  		tr_np = of_parse_phandle(child, "trip", 0);
d67921b3a074286 Rafael J. Wysocki 2024-07-31  322  		if (tr_np != trip->priv) {
8a81cf96f5510aa Julia Lawall      2023-09-07 @323  			of_node_put(child);
d67921b3a074286 Rafael J. Wysocki 2024-07-31  324  			continue;
d67921b3a074286 Rafael J. Wysocki 2024-07-31  325  		}
d67921b3a074286 Rafael J. Wysocki 2024-07-31  326  
d67921b3a074286 Rafael J. Wysocki 2024-07-31  327  		/* The trip has been found, look up the cdev. */
d67921b3a074286 Rafael J. Wysocki 2024-07-31  328  		count = of_count_phandle_with_args(child, "cooling-device", "#cooling-cells");
d67921b3a074286 Rafael J. Wysocki 2024-07-31  329  		if (count <= 0)
d67921b3a074286 Rafael J. Wysocki 2024-07-31  330  			pr_err("Add a cooling_device property with at least one device\n");
d67921b3a074286 Rafael J. Wysocki 2024-07-31  331  
d67921b3a074286 Rafael J. Wysocki 2024-07-31  332  		for (i = 0; i < count; i++) {
d67921b3a074286 Rafael J. Wysocki 2024-07-31  333  			result = thermal_of_get_cooling_spec(child, i, cdev, c);
d67921b3a074286 Rafael J. Wysocki 2024-07-31  334  			if (result)
3fd6d6e2b4e80fe Daniel Lezcano    2022-08-05  335  				break;
3fd6d6e2b4e80fe Daniel Lezcano    2022-08-05  336  		}
d67921b3a074286 Rafael J. Wysocki 2024-07-31  337  
d67921b3a074286 Rafael J. Wysocki 2024-07-31  338  		of_node_put(child);
d67921b3a074286 Rafael J. Wysocki 2024-07-31  339  		break;
8a81cf96f5510aa Julia Lawall      2023-09-07  340  	}
3fd6d6e2b4e80fe Daniel Lezcano    2022-08-05  341  
3fd6d6e2b4e80fe Daniel Lezcano    2022-08-05  342  	of_node_put(cm_np);
3fd6d6e2b4e80fe Daniel Lezcano    2022-08-05  343  out:
3fd6d6e2b4e80fe Daniel Lezcano    2022-08-05  344  	of_node_put(tz_np);
3fd6d6e2b4e80fe Daniel Lezcano    2022-08-05  345  
d67921b3a074286 Rafael J. Wysocki 2024-07-31  346  	return result;
3fd6d6e2b4e80fe Daniel Lezcano    2022-08-05  347  }
3fd6d6e2b4e80fe Daniel Lezcano    2022-08-05  348  

:::::: The code at line 323 was first introduced by commit
:::::: 8a81cf96f5510aaf9a65d103f7405079a7b0fcc5 thermal/of: add missing of_node_put()

:::::: TO: Julia Lawall <Julia.Lawall@inria.fr>
:::::: CC: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

                 reply	other threads:[~2024-08-17 13:19 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=202408172115.o4q95c8X-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=julia.lawall@inria.fr \
    --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.