aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMinfei Huang <mnghuan@gmail.com>2016-08-02 17:05:45 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2016-08-02 19:35:24 -0400
commit4caf9615247aceab56e91df6c0e11892ea55f4f0 (patch)
tree03c9284494c49c83efb88b3fc8dd63d42e206f0b
parentb06fb415331a7beb841f3d20d0fe60f6f0787dba (diff)
kexec: return error number directly
This is a cleanup patch to make kexec more clear to return error number directly. The variable result is useless, because there is no other function's return value assignes to it. So remove it. Link: http://lkml.kernel.org/r/1464179273-57668-1-git-send-email-mnghuan@gmail.com Signed-off-by: Minfei Huang <mnghuan@gmail.com> Cc: Dave Young <dyoung@redhat.com> Cc: Baoquan He <bhe@redhat.com> Cc: Borislav Petkov <bp@suse.de> Cc: Xunlei Pang <xlpang@redhat.com> Cc: Atsushi Kumagai <ats-kumagai@wm.jp.nec.com> Cc: Vivek Goyal <vgoyal@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--kernel/kexec_core.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/kernel/kexec_core.c b/kernel/kexec_core.c
index 56b3ed0927b0..23311c803b1b 100644
--- a/kernel/kexec_core.c
+++ b/kernel/kexec_core.c
@@ -147,7 +147,7 @@ static struct page *kimage_alloc_page(struct kimage *image,
147 147
148int sanity_check_segment_list(struct kimage *image) 148int sanity_check_segment_list(struct kimage *image)
149{ 149{
150 int result, i; 150 int i;
151 unsigned long nr_segments = image->nr_segments; 151 unsigned long nr_segments = image->nr_segments;
152 152
153 /* 153 /*
@@ -163,16 +163,15 @@ int sanity_check_segment_list(struct kimage *image)
163 * simply because addresses are changed to page size 163 * simply because addresses are changed to page size
164 * granularity. 164 * granularity.
165 */ 165 */
166 result = -EADDRNOTAVAIL;
167 for (i = 0; i < nr_segments; i++) { 166 for (i = 0; i < nr_segments; i++) {
168 unsigned long mstart, mend; 167 unsigned long mstart, mend;
169 168
170 mstart = image->segment[i].mem; 169 mstart = image->segment[i].mem;
171 mend = mstart + image->segment[i].memsz; 170 mend = mstart + image->segment[i].memsz;
172 if ((mstart & ~PAGE_MASK) || (mend & ~PAGE_MASK)) 171 if ((mstart & ~PAGE_MASK) || (mend & ~PAGE_MASK))
173 return result; 172 return -EADDRNOTAVAIL;
174 if (mend >= KEXEC_DESTINATION_MEMORY_LIMIT) 173 if (mend >= KEXEC_DESTINATION_MEMORY_LIMIT)
175 return result; 174 return -EADDRNOTAVAIL;
176 } 175 }
177 176
178 /* Verify our destination addresses do not overlap. 177 /* Verify our destination addresses do not overlap.
@@ -180,7 +179,6 @@ int sanity_check_segment_list(struct kimage *image)
180 * through very weird things can happen with no 179 * through very weird things can happen with no
181 * easy explanation as one segment stops on another. 180 * easy explanation as one segment stops on another.
182 */ 181 */
183 result = -EINVAL;
184 for (i = 0; i < nr_segments; i++) { 182 for (i = 0; i < nr_segments; i++) {
185 unsigned long mstart, mend; 183 unsigned long mstart, mend;
186 unsigned long j; 184 unsigned long j;
@@ -194,7 +192,7 @@ int sanity_check_segment_list(struct kimage *image)
194 pend = pstart + image->segment[j].memsz; 192 pend = pstart + image->segment[j].memsz;
195 /* Do the segments overlap ? */ 193 /* Do the segments overlap ? */
196 if ((mend > pstart) && (mstart < pend)) 194 if ((mend > pstart) && (mstart < pend))
197 return result; 195 return -EINVAL;
198 } 196 }
199 } 197 }
200 198
@@ -203,10 +201,9 @@ int sanity_check_segment_list(struct kimage *image)
203 * and it is easier to check up front than to be surprised 201 * and it is easier to check up front than to be surprised
204 * later on. 202 * later on.
205 */ 203 */
206 result = -EINVAL;
207 for (i = 0; i < nr_segments; i++) { 204 for (i = 0; i < nr_segments; i++) {
208 if (image->segment[i].bufsz > image->segment[i].memsz) 205 if (image->segment[i].bufsz > image->segment[i].memsz)
209 return result; 206 return -EINVAL;
210 } 207 }
211 208
212 /* 209 /*
@@ -220,7 +217,6 @@ int sanity_check_segment_list(struct kimage *image)
220 */ 217 */
221 218
222 if (image->type == KEXEC_TYPE_CRASH) { 219 if (image->type == KEXEC_TYPE_CRASH) {
223 result = -EADDRNOTAVAIL;
224 for (i = 0; i < nr_segments; i++) { 220 for (i = 0; i < nr_segments; i++) {
225 unsigned long mstart, mend; 221 unsigned long mstart, mend;
226 222
@@ -229,7 +225,7 @@ int sanity_check_segment_list(struct kimage *image)
229 /* Ensure we are within the crash kernel limits */ 225 /* Ensure we are within the crash kernel limits */
230 if ((mstart < crashk_res.start) || 226 if ((mstart < crashk_res.start) ||
231 (mend > crashk_res.end)) 227 (mend > crashk_res.end))
232 return result; 228 return -EADDRNOTAVAIL;
233 } 229 }
234 } 230 }
235 231