From: Andrew Goodbody Date: Thu, 7 Aug 2025 10:04:04 +0000 (+0100) Subject: pinctrl: zynqmp: Ensure ret is initialised X-Git-Tag: v2025.10-rc3~4^2~10 X-Git-Url: https://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7aac8439445793baa9313a7d5139b77f968b2885;p=pandora-u-boot.git 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 --- 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)