Skip to contentSkip to conversation

powerpc/fsl: fix compiler warning in fsl_wakeup_sys_init()

PATCH New Greg Kroah-Hartman 1 participant 1 message Mar 27, 2023 PowerPC

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 powerpc/fsl: fix compiler warning in fsl_wakeup_sys_init()

Commit c93bd175414a ("powerpc/fsl: move to use bus_get_dev_root()") changed to use bus_get_dev_root() but didn't consider that the function can fail and return an uninitialized value of ret (hint, the function can never fail, but the compiler doesn't know that.)

Fix this up by setting ret to -EINVAL just in case something really goes wrong with the call to bus_get_dev_root().

Cc Michael Ellerman <[email protected]>
Cc Nicholas Piggin <[email protected]>
Cc Christophe Leroy <[email protected]>
Fixes c93bd175414a ("powerpc/fsl: move to use bus_get_dev_root()")
---
 arch/powerpc/sysdev/fsl_mpic_timer_wakeup.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/sysdev/fsl_mpic_timer_wakeup.c +1 -1
index 147b5d8bb904..ce6c739c51e5 100644
@@ -117,7 +117,7 @@ static struct device_attribute mpic_attributes = __ATTR(timer_wakeup, 0644,
 static int __init fsl_wakeup_sys_init(void)
 {
 	struct device *dev_root;
-	int ret;
+	int ret = -EINVAL;
 
 	fsl_wakeup = kzalloc(sizeof(struct fsl_mpic_timer_wakeup), GFP_KERNEL);
 	if (!fsl_wakeup)
Signature · 1 line
2.40.0