powerpc: Avoid ignoring copyin()'s return value

A recent change made it possible for cpu_set_upcall() to return an
error.  Do that here instead of ignoring an error from copyin().

Reviewed by:	jhibbits
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D43105
This commit is contained in:
Mark Johnston 2023-12-25 20:40:16 -05:00
parent 3fde275167
commit bdf03b4bcc

View file

@ -1155,6 +1155,9 @@ cpu_set_upcall(struct thread *td, void (*entry)(void *), void *arg,
{
struct trapframe *tf;
uintptr_t sp;
#ifdef __powerpc64__
int error;
#endif
tf = td->td_frame;
/* align stack and alloc space for frame ptr and saved LR */
@ -1182,10 +1185,12 @@ cpu_set_upcall(struct thread *td, void (*entry)(void *), void *arg,
tf->srr0 = (register_t)entry;
/* ELFv2 ABI requires that the global entry point be in r12. */
tf->fixreg[12] = (register_t)entry;
}
else {
} else {
register_t entry_desc[3];
(void)copyin((void *)entry, entry_desc, sizeof(entry_desc));
error = copyin((void *)entry, entry_desc,
sizeof(entry_desc));
if (error != 0)
return (error);
tf->srr0 = entry_desc[0];
tf->fixreg[2] = entry_desc[1];
tf->fixreg[11] = entry_desc[2];