]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
of: unittest: Fix compile in the non-dynamic case
authorChristian A. Ehrhardt <lk@c--e.de>
Mon, 29 Jan 2024 19:25:56 +0000 (20:25 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 23 Feb 2024 07:42:23 +0000 (08:42 +0100)
commit3f9b9585b7e4b4477de181eaf447af495c0e52c8
treeb2256e75d87c057514f0d1cdf177c224571e80cf
parentdc8bce9c71ef0d66e309c767bd24a6aede9ae1f8
of: unittest: Fix compile in the non-dynamic case

[ Upstream commit 607aad1e4356c210dbef9022955a3089377909b2 ]

If CONFIG_OF_KOBJ is not set, a device_node does not contain a
kobj and attempts to access the embedded kobj via kref_read break
the compile.

Replace affected kref_read calls with a macro that reads the
refcount if it exists and returns 1 if there is no embedded kobj.

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202401291740.VP219WIz-lkp@intel.com/
Fixes: 4dde83569832 ("of: Fix double free in of_parse_phandle_with_args_map")
Signed-off-by: Christian A. Ehrhardt <lk@c--e.de>
Link: https://lore.kernel.org/r/20240129192556.403271-1-lk@c--e.de
Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/of/unittest.c