public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
* [clk:clk-parent-rewrite 18/78] drivers/clk/clk.c:371:11-16: WARNING: Unsigned expression compared with zero: index >= 0 (fwd)
@ 2019-05-03  7:38 Julia Lawall
  2019-05-03 16:22 ` Stephen Boyd
  0 siblings, 1 reply; 2+ messages in thread
From: Julia Lawall @ 2019-05-03  7:38 UTC (permalink / raw)
  To: Stephen Boyd; +Cc: linux-clk, linux-arm-kernel, kbuild-all

On line 371, index is unsigned, so it is always >= 0.

julia

---------- Forwarded message ----------
Date: Fri, 3 May 2019 15:30:37 +0800
From: kbuild test robot <lkp@intel.com>
To: kbuild@01.org
Cc: Julia Lawall <julia.lawall@lip6.fr>
Subject: [clk:clk-parent-rewrite 18/78] drivers/clk/clk.c:371:11-16: WARNING:
    Unsigned expression compared with zero: index >= 0

CC: kbuild-all@01.org
CC: linux-clk@vger.kernel.org
CC: linux-arm-kernel@lists.infradead.org
TO: Stephen Boyd <sboyd@kernel.org>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/clk/linux.git clk-parent-rewrite
head:   f5e93ab2421d0dd27acac9159d9c4834cd5705e7
commit: 9fd6fd58989e06bc5fe92f5aef85a64f63340ab1 [18/78] clk: Cache core in clk_fetch_parent_index() without names
:::::: branch date: 12 hours ago
:::::: commit date: 34 hours ago

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>
Reported-by: Julia Lawall <julia.lawall@lip6.fr>

>> drivers/clk/clk.c:371:11-16: WARNING: Unsigned expression compared with zero: index >= 0

# https://git.kernel.org/pub/scm/linux/kernel/git/clk/linux.git/commit/?id=9fd6fd58989e06bc5fe92f5aef85a64f63340ab1
git remote add clk https://git.kernel.org/pub/scm/linux/kernel/git/clk/linux.git
git remote update clk
git checkout 9fd6fd58989e06bc5fe92f5aef85a64f63340ab1
vim +371 drivers/clk/clk.c

bddca894 Prashant Gaikwad 2012-12-26  326
fc0c209c Stephen Boyd     2019-04-12  327  /**
dde4eff4 Stephen Boyd     2019-04-12  328   * clk_core_get - Find the clk_core parent of a clk
fc0c209c Stephen Boyd     2019-04-12  329   * @core: clk to find parent of
9fd6fd58 Stephen Boyd     2019-04-30  330   * @p_index: parent index to search for
fc0c209c Stephen Boyd     2019-04-12  331   *
fc0c209c Stephen Boyd     2019-04-12  332   * This is the preferred method for clk providers to find the parent of a
fc0c209c Stephen Boyd     2019-04-12  333   * clk when that parent is external to the clk controller. The parent_names
fc0c209c Stephen Boyd     2019-04-12  334   * array is indexed and treated as a local name matching a string in the device
dde4eff4 Stephen Boyd     2019-04-12  335   * node's 'clock-names' property or as the 'con_id' matching the device's
dde4eff4 Stephen Boyd     2019-04-12  336   * dev_name() in a clk_lookup. This allows clk providers to use their own
fc0c209c Stephen Boyd     2019-04-12  337   * namespace instead of looking for a globally unique parent string.
fc0c209c Stephen Boyd     2019-04-12  338   *
fc0c209c Stephen Boyd     2019-04-12  339   * For example the following DT snippet would allow a clock registered by the
fc0c209c Stephen Boyd     2019-04-12  340   * clock-controller@c001 that has a clk_init_data::parent_data array
fc0c209c Stephen Boyd     2019-04-12  341   * with 'xtal' in the 'name' member to find the clock provided by the
fc0c209c Stephen Boyd     2019-04-12  342   * clock-controller@f00abcd without needing to get the globally unique name of
fc0c209c Stephen Boyd     2019-04-12  343   * the xtal clk.
fc0c209c Stephen Boyd     2019-04-12  344   *
fc0c209c Stephen Boyd     2019-04-12  345   *      parent: clock-controller@f00abcd {
fc0c209c Stephen Boyd     2019-04-12  346   *              reg = <0xf00abcd 0xabcd>;
fc0c209c Stephen Boyd     2019-04-12  347   *              #clock-cells = <0>;
fc0c209c Stephen Boyd     2019-04-12  348   *      };
fc0c209c Stephen Boyd     2019-04-12  349   *
fc0c209c Stephen Boyd     2019-04-12  350   *      clock-controller@c001 {
fc0c209c Stephen Boyd     2019-04-12  351   *              reg = <0xc001 0xf00d>;
fc0c209c Stephen Boyd     2019-04-12  352   *              clocks = <&parent>;
fc0c209c Stephen Boyd     2019-04-12  353   *              clock-names = "xtal";
fc0c209c Stephen Boyd     2019-04-12  354   *              #clock-cells = <1>;
fc0c209c Stephen Boyd     2019-04-12  355   *      };
fc0c209c Stephen Boyd     2019-04-12  356   *
fc0c209c Stephen Boyd     2019-04-12  357   * Returns: -ENOENT when the provider can't be found or the clk doesn't
fc0c209c Stephen Boyd     2019-04-12  358   * exist in the provider. -EINVAL when the name can't be found. NULL when the
fc0c209c Stephen Boyd     2019-04-12  359   * provider knows about the clk but it isn't provided on this system.
fc0c209c Stephen Boyd     2019-04-12  360   * A valid clk_core pointer when the clk can be found in the provider.
fc0c209c Stephen Boyd     2019-04-12  361   */
9fd6fd58 Stephen Boyd     2019-04-30  362  static struct clk_core *clk_core_get(struct clk_core *core, u8 p_index)
fc0c209c Stephen Boyd     2019-04-12  363  {
9fd6fd58 Stephen Boyd     2019-04-30  364  	const char *name = core->parents[p_index].fw_name;
9fd6fd58 Stephen Boyd     2019-04-30  365  	u8 index = core->parents[p_index].index;
dde4eff4 Stephen Boyd     2019-04-12  366  	struct clk_hw *hw = ERR_PTR(-ENOENT);
dde4eff4 Stephen Boyd     2019-04-12  367  	struct device *dev = core->dev;
dde4eff4 Stephen Boyd     2019-04-12  368  	const char *dev_id = dev ? dev_name(dev) : NULL;
fc0c209c Stephen Boyd     2019-04-12  369  	struct device_node *np = core->of_node;
fc0c209c Stephen Boyd     2019-04-12  370
601b6e93 Stephen Boyd     2019-04-12 @371  	if (np && index >= 0)
601b6e93 Stephen Boyd     2019-04-12  372  		hw = of_clk_get_hw(np, index, name);
dde4eff4 Stephen Boyd     2019-04-12  373
dde4eff4 Stephen Boyd     2019-04-12  374  	/*
dde4eff4 Stephen Boyd     2019-04-12  375  	 * If the DT search above couldn't find the provider or the provider
dde4eff4 Stephen Boyd     2019-04-12  376  	 * didn't know about this clk, fallback to looking up via clkdev based
dde4eff4 Stephen Boyd     2019-04-12  377  	 * clk_lookups
dde4eff4 Stephen Boyd     2019-04-12  378  	 */
601b6e93 Stephen Boyd     2019-04-12  379  	if (PTR_ERR(hw) == -ENOENT && name)
dde4eff4 Stephen Boyd     2019-04-12  380  		hw = clk_find_hw(dev_id, name);
dde4eff4 Stephen Boyd     2019-04-12  381
dde4eff4 Stephen Boyd     2019-04-12  382  	if (IS_ERR(hw))
fc0c209c Stephen Boyd     2019-04-12  383  		return ERR_CAST(hw);
fc0c209c Stephen Boyd     2019-04-12  384
fc0c209c Stephen Boyd     2019-04-12  385  	return hw->core;
fc0c209c Stephen Boyd     2019-04-12  386  }
fc0c209c Stephen Boyd     2019-04-12  387

:::::: The code at line 371 was first introduced by commit
:::::: 601b6e93304a65f8f7c37168763ab9ba5b195ce5 clk: Allow parents to be specified via clkspec index

:::::: TO: Stephen Boyd <sboyd@kernel.org>
:::::: CC: Stephen Boyd <sboyd@kernel.org>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [clk:clk-parent-rewrite 18/78] drivers/clk/clk.c:371:11-16: WARNING: Unsigned expression compared with zero: index >= 0 (fwd)
  2019-05-03  7:38 [clk:clk-parent-rewrite 18/78] drivers/clk/clk.c:371:11-16: WARNING: Unsigned expression compared with zero: index >= 0 (fwd) Julia Lawall
@ 2019-05-03 16:22 ` Stephen Boyd
  0 siblings, 0 replies; 2+ messages in thread
From: Stephen Boyd @ 2019-05-03 16:22 UTC (permalink / raw)
  To: Julia Lawall; +Cc: linux-clk, linux-arm-kernel, kbuild-all

Quoting Julia Lawall (2019-05-03 00:38:12)
> On line 371, index is unsigned, so it is always >= 0.
> 

Awesome thanks!


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2019-05-03 16:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-05-03  7:38 [clk:clk-parent-rewrite 18/78] drivers/clk/clk.c:371:11-16: WARNING: Unsigned expression compared with zero: index >= 0 (fwd) Julia Lawall
2019-05-03 16:22 ` Stephen Boyd

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