Skip to content

Commit 4caf961

Browse files
Minfei Huangtorvalds
authored andcommitted
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>
1 parent b06fb41 commit 4caf961

1 file changed

Lines changed: 6 additions & 10 deletions

File tree

‎kernel/kexec_core.c‎

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ static struct page *kimage_alloc_page(struct kimage *image,
147147

148148
int sanity_check_segment_list(struct kimage *image)
149149
{
150-
int result, i;
150+
int i;
151151
unsigned long nr_segments = image->nr_segments;
152152

153153
/*
@@ -163,24 +163,22 @@ int sanity_check_segment_list(struct kimage *image)
163163
* simply because addresses are changed to page size
164164
* granularity.
165165
*/
166-
result = -EADDRNOTAVAIL;
167166
for (i = 0; i < nr_segments; i++) {
168167
unsigned long mstart, mend;
169168

170169
mstart = image->segment[i].mem;
171170
mend = mstart + image->segment[i].memsz;
172171
if ((mstart & ~PAGE_MASK) || (mend & ~PAGE_MASK))
173-
return result;
172+
return -EADDRNOTAVAIL;
174173
if (mend >= KEXEC_DESTINATION_MEMORY_LIMIT)
175-
return result;
174+
return -EADDRNOTAVAIL;
176175
}
177176

178177
/* Verify our destination addresses do not overlap.
179178
* If we alloed overlapping destination addresses
180179
* through very weird things can happen with no
181180
* easy explanation as one segment stops on another.
182181
*/
183-
result = -EINVAL;
184182
for (i = 0; i < nr_segments; i++) {
185183
unsigned long mstart, mend;
186184
unsigned long j;
@@ -194,7 +192,7 @@ int sanity_check_segment_list(struct kimage *image)
194192
pend = pstart + image->segment[j].memsz;
195193
/* Do the segments overlap ? */
196194
if ((mend > pstart) && (mstart < pend))
197-
return result;
195+
return -EINVAL;
198196
}
199197
}
200198

@@ -203,10 +201,9 @@ int sanity_check_segment_list(struct kimage *image)
203201
* and it is easier to check up front than to be surprised
204202
* later on.
205203
*/
206-
result = -EINVAL;
207204
for (i = 0; i < nr_segments; i++) {
208205
if (image->segment[i].bufsz > image->segment[i].memsz)
209-
return result;
206+
return -EINVAL;
210207
}
211208

212209
/*
@@ -220,7 +217,6 @@ int sanity_check_segment_list(struct kimage *image)
220217
*/
221218

222219
if (image->type == KEXEC_TYPE_CRASH) {
223-
result = -EADDRNOTAVAIL;
224220
for (i = 0; i < nr_segments; i++) {
225221
unsigned long mstart, mend;
226222

@@ -229,7 +225,7 @@ int sanity_check_segment_list(struct kimage *image)
229225
/* Ensure we are within the crash kernel limits */
230226
if ((mstart < crashk_res.start) ||
231227
(mend > crashk_res.end))
232-
return result;
228+
return -EADDRNOTAVAIL;
233229
}
234230
}
235231

0 commit comments

Comments
 (0)