Prevent new device from being freed in device_replace when
device_unlock is called along the function chain triggered
by setting the old device as not present
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
struct device_user *dep, *tmp;
bool present = odev->present;
+ __devlock++;
if (present)
device_set_present(odev, false);
safe_list_add(&dep->list, &dev->users);
dep->dev = dev;
}
+ __devlock--;
+
device_free(odev);
if (present)