driver core: register_memory/unregister_memory clean ups and bugfix