driver-core: fix race condition in get_device_parent()