Skip to content

Commit 2d481bd

Browse files
brooniewilldeacon
authored andcommitted
arm64/fp: Reindent fpsimd_save()
Currently all the active code in fpsimd_save() is inside a check for TIF_FOREIGN_FPSTATE. Reduce the indentation level by changing to return from the function if TIF_FOREIGN_FPSTATE is set. Signed-off-by: Mark Brown <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Will Deacon <[email protected]>
1 parent 5816b3e commit 2d481bd

File tree

1 file changed

+20
-18
lines changed

1 file changed

+20
-18
lines changed

arch/arm64/kernel/fpsimd.c

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -308,24 +308,26 @@ static void fpsimd_save(void)
308308
WARN_ON(!system_supports_fpsimd());
309309
WARN_ON(!have_cpu_fpsimd_context());
310310

311-
if (!test_thread_flag(TIF_FOREIGN_FPSTATE)) {
312-
if (IS_ENABLED(CONFIG_ARM64_SVE) &&
313-
test_thread_flag(TIF_SVE)) {
314-
if (WARN_ON(sve_get_vl() != last->sve_vl)) {
315-
/*
316-
* Can't save the user regs, so current would
317-
* re-enter user with corrupt state.
318-
* There's no way to recover, so kill it:
319-
*/
320-
force_signal_inject(SIGKILL, SI_KERNEL, 0, 0);
321-
return;
322-
}
323-
324-
sve_save_state((char *)last->sve_state +
325-
sve_ffr_offset(last->sve_vl),
326-
&last->st->fpsr);
327-
} else
328-
fpsimd_save_state(last->st);
311+
if (test_thread_flag(TIF_FOREIGN_FPSTATE))
312+
return;
313+
314+
if (IS_ENABLED(CONFIG_ARM64_SVE) &&
315+
test_thread_flag(TIF_SVE)) {
316+
if (WARN_ON(sve_get_vl() != last->sve_vl)) {
317+
/*
318+
* Can't save the user regs, so current would
319+
* re-enter user with corrupt state.
320+
* There's no way to recover, so kill it:
321+
*/
322+
force_signal_inject(SIGKILL, SI_KERNEL, 0, 0);
323+
return;
324+
}
325+
326+
sve_save_state((char *)last->sve_state +
327+
sve_ffr_offset(last->sve_vl),
328+
&last->st->fpsr);
329+
} else {
330+
fpsimd_save_state(last->st);
329331
}
330332
}
331333

0 commit comments

Comments
 (0)