power: hibernate: optimize function structure

Message ID 20230112052453.3365-1-kunyu@nfschina.com
State New
Headers
Series power: hibernate: optimize function structure |

Commit Message

Li kunyu Jan. 12, 2023, 5:24 a.m. UTC
  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.

Signed-off-by: Li kunyu <kunyu@nfschina.com>
---
 arch/x86/power/hibernate.c | 2 --
 1 file changed, 2 deletions(-)
  

Comments

Rafael J. Wysocki Jan. 20, 2023, 4:45 p.m. UTC | #1
On Thu, Jan 12, 2023 at 6:25 AM Li kunyu <kunyu@nfschina.com> wrote:
>
> 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.
>
> Signed-off-by: Li kunyu <kunyu@nfschina.com>

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.

> ---
>  arch/x86/power/hibernate.c | 2 --
>  1 file changed, 2 deletions(-)
>
> diff --git a/arch/x86/power/hibernate.c b/arch/x86/power/hibernate.c
> index 6f955eb1e163..936558c4e821 100644
> --- a/arch/x86/power/hibernate.c
> +++ b/arch/x86/power/hibernate.c
> @@ -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
>
  

Patch

diff --git a/arch/x86/power/hibernate.c b/arch/x86/power/hibernate.c
index 6f955eb1e163..936558c4e821 100644
--- a/arch/x86/power/hibernate.c
+++ b/arch/x86/power/hibernate.c
@@ -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();