sys_swapon: move setting of error nearer use