Now that we don't need the lock, we can return directly. Also, now that
we don't have the old UAPI, we can clean things up and make the whole
function make a bit more sense. Also, drop some pointless braces while
we're just moving code around.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25357>