From 7aac8439445793baa9313a7d5139b77f968b2885 Mon Sep 17 00:00:00 2001 From: Andrew Goodbody Date: Thu, 7 Aug 2025 11:04:04 +0100 Subject: [PATCH] pinctrl: zynqmp: Ensure ret is initialised In zynqmp_pinctrl_prepare_func_groups if called with func->ngroups == 0 then ret will not be assigned to before its value is returned on exit. Initialise ret to ensure it is always valid. This issue was found by Smatch. Signed-off-by: Andrew Goodbody Link: https://lore.kernel.org/r/20250807-pinctrl_misc-v1-3-eeb564a1b032@linaro.org Signed-off-by: Michal Simek --- drivers/pinctrl/pinctrl-zynqmp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pinctrl/pinctrl-zynqmp.c b/drivers/pinctrl/pinctrl-zynqmp.c index 6fa203a3b86..27dadbff8ca 100644 --- a/drivers/pinctrl/pinctrl-zynqmp.c +++ b/drivers/pinctrl/pinctrl-zynqmp.c @@ -204,7 +204,7 @@ static int zynqmp_pinctrl_prepare_func_groups(u32 fid, const char **fgroups; char name[MAX_GROUP_NAME_LEN]; u16 resp[NUM_GROUPS_PER_RESP] = {0}; - int ret, index, i; + int ret = 0, index, i; fgroups = kcalloc(func->ngroups, sizeof(*fgroups), GFP_KERNEL); if (!fgroups) -- 2.47.3