kernel/sys.c: fix and improve control flow in __sys_setres[ug]id()