[Patch] kexec: remove redundant if-else

WANG Cong xiyou.wangcong at gmail.com
Fri Jul 18 11:04:10 EDT 2008


These if-else's can be removed.

Signed-off-by: WANG Cong <wangcong at zeuux.org>
Cc: ebiederm at 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;
 }
 



More information about the kexec mailing list