mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] PM, kernel/power/user.c: Replace unintuitive 'if' condition with 'else'
@ 2011-12-02 18:06 Srivatsa S. Bhat
  2011-12-02 23:31 ` Rafael J. Wysocki
  0 siblings, 1 reply; 2+ messages in thread
From: Srivatsa S. Bhat @ 2011-12-02 18:06 UTC (permalink / raw)
  To: rjw; +Cc: pavel, len.brown, linux-kernel, linux-pm

In the snapshot_ioctl() function, under SNAPSHOT_FREEZE, the code below
freeze_processes() is a bit unintuitive. Improve it by replacing the
second 'if' condition with an 'else' clause.

Signed-off-by: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
---

 kernel/power/user.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/kernel/power/user.c b/kernel/power/user.c
index 7cc3f5b..8c64d1c 100644
--- a/kernel/power/user.c
+++ b/kernel/power/user.c
@@ -259,7 +259,7 @@ static long snapshot_ioctl(struct file *filp, unsigned int cmd,
 		error = freeze_processes();
 		if (error)
 			usermodehelper_enable();
-		if (!error)
+		else
 			data->frozen = 1;
 		break;
 


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] PM, kernel/power/user.c: Replace unintuitive 'if' condition with 'else'
  2011-12-02 18:06 [PATCH] PM, kernel/power/user.c: Replace unintuitive 'if' condition with 'else' Srivatsa S. Bhat
@ 2011-12-02 23:31 ` Rafael J. Wysocki
  0 siblings, 0 replies; 2+ messages in thread
From: Rafael J. Wysocki @ 2011-12-02 23:31 UTC (permalink / raw)
  To: Srivatsa S. Bhat; +Cc: pavel, len.brown, linux-kernel, linux-pm

On Friday, December 02, 2011, Srivatsa S. Bhat wrote:
> In the snapshot_ioctl() function, under SNAPSHOT_FREEZE, the code below
> freeze_processes() is a bit unintuitive. Improve it by replacing the
> second 'if' condition with an 'else' clause.
> 
> Signed-off-by: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>

Applied to linux-pm/linux-next.

Thanks,
Rafael


> ---
> 
>  kernel/power/user.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/kernel/power/user.c b/kernel/power/user.c
> index 7cc3f5b..8c64d1c 100644
> --- a/kernel/power/user.c
> +++ b/kernel/power/user.c
> @@ -259,7 +259,7 @@ static long snapshot_ioctl(struct file *filp, unsigned int cmd,
>  		error = freeze_processes();
>  		if (error)
>  			usermodehelper_enable();
> -		if (!error)
> +		else
>  			data->frozen = 1;
>  		break;
>  
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-pm" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
> 


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-12-02 23:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-12-02 18:06 [PATCH] PM, kernel/power/user.c: Replace unintuitive 'if' condition with 'else' Srivatsa S. Bhat
2011-12-02 23:31 ` Rafael J. Wysocki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®