Skip to contentSkip to conversation

power: hibernate: optimize function structure

PATCH In review Li kunyu 2 participants 2 messages Jan 12, 2023 – Jan 20, 2023

Subsystems (2)
lore
Share & tools
lore

Li kunyu

author
#0 lore raw

PATCH 1/1 power: hibernate: optimize function structure

The goto statement jump is not required at the end of the if statement block, because it will be executed to the lower part of the goto statement.

---
 arch/x86/power/hibernate.c | 2 --
 1 file changed, 2 deletions(-)
arch/x86/power/hibernate.c +0 -2
index 6f955eb1e163..936558c4e821 100644
@@ -210,8 +210,6 @@ int arch_resume_nosmt(void)
 		if (ret)
 			goto out;
 		ret = cpuhp_smt_disable(old);
-		if (ret)
-			goto out;
 	}
 out:
 	cpu_hotplug_disable();
Signature · 1 line
2.18.2
#1 lore raw
Quoted 6 lines · Li kunyu

The goto statement jump is not required at the end of the if statement block, because it will be executed to the lower part of the goto statement.

The patch itself is OK, but its subject should be something like "PM:
hibernate: x86: Drop unneeded goto statement from arch_resume_nosmt()" and the changelog should be more precise, for example:

"The last goto statement in arch_resume_nosmt() is not necessary, because the target label is right next to it."

Please update.

Quoted 20 lines
---
 arch/x86/power/hibernate.c | 2 --
 1 file changed, 2 deletions(-)
arch/x86/power/hibernate.c +0 -3
index 6f955eb1e163..936558c4e821 100644
@@ -210,8 +210,6 @@ int arch_resume_nosmt(void)
                if (ret)
                        goto out;
                ret = cpuhp_smt_disable(old);
-               if (ret)
-                       goto out;
        }
 out:
        cpu_hotplug_disable();
--

2.18.2