[clk:clk-parent-rewrite 21/32] drivers/clk/clk.c:2369:6-13: ERROR: PTR_ERR applied after initialization to constant on line 2361

kbuild test robot lkp at intel.com
Fri Mar 8 17:02:25 PST 2019


tree:   https://git.kernel.org/pub/scm/linux/kernel/git/clk/linux.git clk-parent-rewrite
head:   6a6d2ba76f95f9e4f7afea765841f40eb33d55d4
commit: 1dee7b91c5de9c8684a5deb13769505518040f35 [21/32] clk: Introduce get_parent_hw clk op


coccinelle warnings: (new ones prefixed by >>)

>> drivers/clk/clk.c:2369:6-13: ERROR: PTR_ERR applied after initialization to constant on line 2361

vim +2369 drivers/clk/clk.c

  2334	
  2335	static struct clk_core *
  2336	__clk_init_parent(struct clk_core *core, bool update_orphan)
  2337	{
  2338		u8 index = 0;
  2339		struct clk_hw *parent_hw = NULL;
  2340	
  2341		if (core->ops->get_parent_hw) {
  2342			parent_hw = core->ops->get_parent_hw(core->hw);
  2343		} else {
  2344			if (core->num_parents > 1 && core->ops->get_parent)
  2345				index = core->ops->get_parent(core->hw);
  2346	
  2347			if (index >= core->num_parents) {
  2348				/*
  2349				 * Overwrite with NULL here because we can't
  2350				 * differentiate true errors in getting the index from
  2351				 * the case where the clk isn't found because it never
  2352				 * exists or isn't described as a possible parent.
  2353				 *
  2354				 * Note that we don't update the orphan status to true
  2355				 * in this case, because we can't really know for sure
  2356				 * if the clk is truly orphaned or not. To avoid this,
  2357				 * implement .get_parent_hw or use the direct pointer
  2358				 * mechanism of struct clk_parent_data::hw to point
  2359				 * to the parent clk directly.
  2360				 */
> 2361				parent_hw = NULL;
  2362			} else {
  2363				parent_hw = clk_hw_get_parent_by_index(core->hw, index);
  2364			}
  2365		}
  2366	
  2367		if (IS_ERR_OR_NULL(parent_hw)) {
  2368			/* Parent clk provider hasn't probed yet, orphan it */
> 2369			if (PTR_ERR(parent_hw) == -EPROBE_DEFER) {
  2370				if (update_orphan)
  2371					core->orphan = true;
  2372	
  2373				/* Orphans don't have a parent, so use NULL */
  2374				return NULL;
  2375			}
  2376	
  2377			return ERR_CAST(parent_hw);
  2378		}
  2379	
  2380		if (update_orphan)
  2381			core->orphan = parent_hw->core->orphan;
  2382		return parent_hw->core;
  2383	}
  2384	

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



More information about the linux-arm-kernel mailing list