Index: sys/amd64/amd64/fpu.c =================================================================== --- sys/amd64/amd64/fpu.c +++ sys/amd64/amd64/fpu.c @@ -965,7 +965,7 @@ return ((struct savefpu *)p); } -int +void fpu_kern_enter(struct thread *td, struct fpu_kern_ctx *ctx, u_int flags) { struct pcb *pcb; @@ -997,11 +997,11 @@ fpurestore(fpu_initialstate); set_pcb_flags(pcb, PCB_KERNFPU | PCB_FPUNOSAVE | PCB_FPUINITDONE); - return (0); + return; } if ((flags & FPU_KERN_KTHR) != 0 && is_fpu_kern_thread(0)) { ctx->flags = FPU_KERN_CTX_DUMMY | FPU_KERN_CTX_INUSE; - return (0); + return; } KASSERT(!PCB_USER_FPU(pcb) || pcb->pcb_save == get_pcb_user_save_pcb(pcb), ("mangled pcb_save")); @@ -1013,7 +1013,7 @@ pcb->pcb_save = fpu_kern_ctx_savefpu(ctx); set_pcb_flags(pcb, PCB_KERNFPU); clear_pcb_flags(pcb, PCB_FPUINITDONE); - return (0); + return; } int Index: sys/amd64/include/fpu.h =================================================================== --- sys/amd64/include/fpu.h +++ sys/amd64/include/fpu.h @@ -72,7 +72,7 @@ void fpuuserinited(struct thread *td); struct fpu_kern_ctx *fpu_kern_alloc_ctx(u_int flags); void fpu_kern_free_ctx(struct fpu_kern_ctx *ctx); -int fpu_kern_enter(struct thread *td, struct fpu_kern_ctx *ctx, +void fpu_kern_enter(struct thread *td, struct fpu_kern_ctx *ctx, u_int flags); int fpu_kern_leave(struct thread *td, struct fpu_kern_ctx *ctx); int fpu_kern_thread(u_int flags); Index: sys/arm64/arm64/vfp.c =================================================================== --- sys/arm64/arm64/vfp.c +++ sys/arm64/arm64/vfp.c @@ -256,7 +256,7 @@ free(ctx, M_FPUKERN_CTX); } -int +void fpu_kern_enter(struct thread *td, struct fpu_kern_ctx *ctx, u_int flags) { struct pcb *pcb; @@ -279,12 +279,12 @@ vfp_enable(); pcb->pcb_fpflags |= PCB_FP_KERN | PCB_FP_NOSAVE | PCB_FP_STARTED; - return (0); + return; } if ((flags & FPU_KERN_KTHR) != 0 && is_fpu_kern_thread(0)) { ctx->flags = FPU_KERN_CTX_DUMMY | FPU_KERN_CTX_INUSE; - return (0); + return; } /* * Check either we are already using the VFP in the kernel, or @@ -300,7 +300,7 @@ pcb->pcb_fpflags |= PCB_FP_KERN; pcb->pcb_fpflags &= ~PCB_FP_STARTED; - return (0); + return; } int Index: sys/arm64/include/vfp.h =================================================================== --- sys/arm64/include/vfp.h +++ sys/arm64/include/vfp.h @@ -60,7 +60,7 @@ struct fpu_kern_ctx *fpu_kern_alloc_ctx(u_int); void fpu_kern_free_ctx(struct fpu_kern_ctx *); -int fpu_kern_enter(struct thread *, struct fpu_kern_ctx *, u_int); +void fpu_kern_enter(struct thread *, struct fpu_kern_ctx *, u_int); int fpu_kern_leave(struct thread *, struct fpu_kern_ctx *); int fpu_kern_thread(u_int); int is_fpu_kern_thread(u_int); Index: sys/crypto/aesni/aesni.c =================================================================== --- sys/crypto/aesni/aesni.c +++ sys/crypto/aesni/aesni.c @@ -577,10 +577,8 @@ kt = is_fpu_kern_thread(0) || (encini == NULL); if (!kt) { ACQUIRE_CTX(ctxidx, ctx); - error = fpu_kern_enter(curthread, ctx, + fpu_kern_enter(curthread, ctx, FPU_KERN_NORMAL | FPU_KERN_KTHR); - if (error != 0) - goto out; } error = 0; @@ -590,7 +588,6 @@ if (!kt) { fpu_kern_leave(curthread, ctx); -out: RELEASE_CTX(ctxidx, ctx); } return (error); @@ -730,10 +727,8 @@ kt = is_fpu_kern_thread(0); if (!kt) { ACQUIRE_CTX(ctxidx, ctx); - error = fpu_kern_enter(curthread, ctx, + fpu_kern_enter(curthread, ctx, FPU_KERN_NORMAL | FPU_KERN_KTHR); - if (error != 0) - goto out2; } /* Do work */ @@ -761,7 +756,6 @@ out: if (!kt) { fpu_kern_leave(curthread, ctx); -out2: RELEASE_CTX(ctxidx, ctx); } return (error); Index: sys/crypto/armv8/armv8_crypto.c =================================================================== --- sys/crypto/armv8/armv8_crypto.c +++ sys/crypto/armv8/armv8_crypto.c @@ -467,7 +467,7 @@ struct fpu_kern_ctx *ctx; uint8_t *buf; uint8_t iv[AES_BLOCK_LEN]; - int allocated, error, i; + int allocated, i; int encflag, ivlen; int kt; @@ -477,15 +477,11 @@ if (buf == NULL) return (ENOMEM); - error = 0; - kt = is_fpu_kern_thread(0); if (!kt) { AQUIRE_CTX(i, ctx); - error = fpu_kern_enter(curthread, ctx, + fpu_kern_enter(curthread, ctx, FPU_KERN_NORMAL | FPU_KERN_KTHR); - if (error != 0) - goto out; } if ((enccrd->crd_flags & CRD_F_KEY_EXPLICIT) != 0) { @@ -534,14 +530,13 @@ if (!kt) { fpu_kern_leave(curthread, ctx); -out: RELEASE_CTX(i, ctx); } if (allocated) { bzero(buf, enccrd->crd_len); free(buf, M_ARMV8_CRYPTO); } - return (error); + return (0); } static device_method_t armv8_crypto_methods[] = { Index: sys/crypto/via/padlock.c =================================================================== --- sys/crypto/via/padlock.c +++ sys/crypto/via/padlock.c @@ -246,12 +246,10 @@ if (macini != NULL) { td = curthread; - error = fpu_kern_enter(td, ses->ses_fpu_ctx, FPU_KERN_NORMAL | + fpu_kern_enter(td, ses->ses_fpu_ctx, FPU_KERN_NORMAL | FPU_KERN_KTHR); - if (error == 0) { - error = padlock_hash_setup(ses, macini); - fpu_kern_leave(td, ses->ses_fpu_ctx); - } + error = padlock_hash_setup(ses, macini); + fpu_kern_leave(td, ses->ses_fpu_ctx); if (error != 0) { padlock_freesession_one(sc, ses, 0); return (error); Index: sys/crypto/via/padlock_cipher.c =================================================================== --- sys/crypto/via/padlock_cipher.c +++ sys/crypto/via/padlock_cipher.c @@ -205,7 +205,7 @@ struct thread *td; u_char *buf, *abuf; uint32_t *key; - int allocated, error; + int allocated; buf = padlock_cipher_alloc(enccrd, crp, &allocated); if (buf == NULL) @@ -250,10 +250,7 @@ } td = curthread; - error = fpu_kern_enter(td, ses->ses_fpu_ctx, FPU_KERN_NORMAL | - FPU_KERN_KTHR); - if (error != 0) - goto out; + fpu_kern_enter(td, ses->ses_fpu_ctx, FPU_KERN_NORMAL | FPU_KERN_KTHR); padlock_cbc(abuf, abuf, enccrd->crd_len / AES_BLOCK_LEN, key, cw, ses->ses_iv); fpu_kern_leave(td, ses->ses_fpu_ctx); @@ -270,10 +267,9 @@ AES_BLOCK_LEN, ses->ses_iv); } - out: if (allocated) { bzero(buf, enccrd->crd_len + 16); free(buf, M_PADLOCK); } - return (error); + return (0); } Index: sys/crypto/via/padlock_hash.c =================================================================== --- sys/crypto/via/padlock_hash.c +++ sys/crypto/via/padlock_hash.c @@ -377,10 +377,7 @@ int error; td = curthread; - error = fpu_kern_enter(td, ses->ses_fpu_ctx, FPU_KERN_NORMAL | - FPU_KERN_KTHR); - if (error != 0) - return (error); + fpu_kern_enter(td, ses->ses_fpu_ctx, FPU_KERN_NORMAL | FPU_KERN_KTHR); if ((maccrd->crd_flags & CRD_F_KEY_EXPLICIT) != 0) padlock_hash_key_setup(ses, maccrd->crd_key, maccrd->crd_klen); Index: sys/dev/efidev/efirt.c =================================================================== --- sys/dev/efidev/efirt.c +++ sys/dev/efidev/efirt.c @@ -194,7 +194,6 @@ { struct thread *td; pmap_t curpmap; - int error; if (efi_runtime == NULL) return (ENXIO); @@ -202,12 +201,7 @@ curpmap = &td->td_proc->p_vmspace->vm_pmap; PMAP_LOCK(curpmap); mtx_lock(&efi_lock); - error = fpu_kern_enter(td, NULL, FPU_KERN_NOCTX); - if (error != 0) { - PMAP_UNLOCK(curpmap); - return (error); - } - + fpu_kern_enter(td, NULL, FPU_KERN_NOCTX); return (efi_arch_enter()); } Index: sys/dev/random/nehemiah.c =================================================================== --- sys/dev/random/nehemiah.c +++ sys/dev/random/nehemiah.c @@ -101,17 +101,14 @@ size_t count, ret; uint64_t tmp; - if ((fpu_kern_enter(curthread, fpu_ctx_save, FPU_KERN_NORMAL) == 0)) { - b = buf; - for (count = c; count > 0; count -= ret) { - ret = MIN(VIA_RNG_store(&tmp), count); - memcpy(b, &tmp, ret); - b += ret; - } - fpu_kern_leave(curthread, fpu_ctx_save); + fpu_kern_enter(curthread, fpu_ctx_save, FPU_KERN_NORMAL); + b = buf; + for (count = c; count > 0; count -= ret) { + ret = MIN(VIA_RNG_store(&tmp), count); + memcpy(b, &tmp, ret); + b += ret; } - else - c = 0; + fpu_kern_leave(curthread, fpu_ctx_save); return (c); } Index: sys/i386/i386/npx.c =================================================================== --- sys/i386/i386/npx.c +++ sys/i386/i386/npx.c @@ -1325,7 +1325,7 @@ return ((union savefpu *)p); } -int +void fpu_kern_enter(struct thread *td, struct fpu_kern_ctx *ctx, u_int flags) { struct pcb *pcb; @@ -1334,7 +1334,7 @@ if ((flags & FPU_KERN_KTHR) != 0 && is_fpu_kern_thread(0)) { ctx->flags = FPU_KERN_CTX_DUMMY | FPU_KERN_CTX_INUSE; - return (0); + return; } pcb = td->td_pcb; KASSERT(!PCB_USER_FPU(pcb) || pcb->pcb_save == @@ -1347,7 +1347,7 @@ pcb->pcb_save = fpu_kern_ctx_savefpu(ctx); pcb->pcb_flags |= PCB_KERNNPX; pcb->pcb_flags &= ~PCB_NPXINITDONE; - return (0); + return; } int Index: sys/i386/include/npx.h =================================================================== --- sys/i386/include/npx.h +++ sys/i386/include/npx.h @@ -76,7 +76,7 @@ struct fpu_kern_ctx *fpu_kern_alloc_ctx(u_int flags); void fpu_kern_free_ctx(struct fpu_kern_ctx *ctx); -int fpu_kern_enter(struct thread *td, struct fpu_kern_ctx *ctx, +void fpu_kern_enter(struct thread *td, struct fpu_kern_ctx *ctx, u_int flags); int fpu_kern_leave(struct thread *td, struct fpu_kern_ctx *ctx); int fpu_kern_thread(u_int flags);