mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: WANG Cong <xiyou.wangcong@gmail.com>
To: LKML <linux-kernel@vger.kernel.org>
Cc: ebiederm@xmission.com, kexec@lists.infradead.org
Subject: [Patch] kexec: remove redundant if-else
Date: Fri, 18 Jul 2008 16:04:10 +0100	[thread overview]
Message-ID: <20080718150410.GB26261@hack.voiplan.pt> (raw)


These if-else's can be removed.

Signed-off-by: WANG Cong <wangcong@zeuux.org>
Cc: ebiederm@xmission.com

---
diff --git a/kernel/kexec.c b/kernel/kexec.c
index 1c5fcac..ea6fa9b 100644
--- a/kernel/kexec.c
+++ b/kernel/kexec.c
@@ -203,13 +203,11 @@ static int do_kimage_alloc(struct kimage **rimage, unsigned long entry,
 			goto out;
 	}
 
-	result = 0;
-out:
-	if (result == 0)
-		*rimage = image;
-	else
-		kfree(image);
+	*rimage = image;
+	return 0;
 
+out:
+	kfree(image);
 	return result;
 
 }
@@ -242,13 +240,11 @@ static int kimage_normal_alloc(struct kimage **rimage, unsigned long entry,
 		goto out;
 	}
 
-	result = 0;
- out:
-	if (result == 0)
-		*rimage = image;
-	else
-		kfree(image);
+	*rimage = image;
+	return 0;
 
+ out:
+	kfree(image);
 	return result;
 }
 
@@ -311,13 +307,11 @@ static int kimage_crash_alloc(struct kimage **rimage, unsigned long entry,
 		goto out;
 	}
 
-	result = 0;
-out:
-	if (result == 0)
-		*rimage = image;
-	else
-		kfree(image);
+	*rimage = image;
+	return 0;
 
+out:
+	kfree(image);
 	return result;
 }
 

             reply	other threads:[~2008-07-18 15:05 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-18 15:04 WANG Cong [this message]
2008-07-18 20:07 ` Eric W. Biederman
2008-07-19 10:16   ` WANG Cong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080718150410.GB26261@hack.voiplan.pt \
    --to=xiyou.wangcong@gmail.com \
    --cc=ebiederm@xmission.com \
    --cc=kexec@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®