]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
clk: microchip: core: correct return value on *_get_parent()
authorBrian Masney <bmasney@redhat.com>
Fri, 5 Dec 2025 19:46:28 +0000 (14:46 -0500)
committerSasha Levin <sashal@kernel.org>
Wed, 4 Mar 2026 12:20:37 +0000 (07:20 -0500)
commitd096d625f44ddeb7aa3b3257b1ffdf307247b088
tree98d5333b64854c2ca11bde9eb390c8f01f843e5b
parentde675f889e4534113ca9d1a06d8e6776f86427e8
clk: microchip: core: correct return value on *_get_parent()

[ Upstream commit 5df96d141cccb37f0c3112a22fc1112ea48e9246 ]

roclk_get_parent() and sclk_get_parent() has the possibility of
returning -EINVAL, however the framework expects this call to always
succeed since the return value is unsigned.

If there is no parent map defined, then the current value programmed in
the hardware is used. Let's use that same value in the case where
-EINVAL is currently returned.

This index is only used by clk_core_get_parent_by_index(), and it
validates that it doesn't overflow the number of available parents.

Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Closes: https://lore.kernel.org/r/202512050233.R9hAWsJN-lkp@intel.com/
Signed-off-by: Brian Masney <bmasney@redhat.com>
Reviewed-by: Claudiu Beznea <claudiu.beznea@tuxon.dev>
Link: https://lore.kernel.org/r/20251205-clk-microchip-fixes-v3-2-a02190705e47@redhat.com
Signed-off-by: Claudiu Beznea <claudiu.beznea@tuxon.dev>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/clk/microchip/clk-core.c