]> 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 08:51:23 +0000 (09:51 +0100)
commitee2ae7ed5c0030913cd9b046bb37c4c90679c5e9
treee75bf7de9d494933f9e567284b1129b371a612c4
parentd7e771d85ad1818e94ae80f320cf6cbad3365223
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