From b5e327e3e988f9060e77c9337fffcfd6d1df54bc Mon Sep 17 00:00:00 2001 From: Stefan Kalkowski Date: Thu, 17 Feb 2022 14:43:14 +0100 Subject: [PATCH] platform_drv: do not return cap of device twice When a device got already acquired by a platform session client, do not return the same capability again, even if the same platform session client requested it. Therefore, make doubtful behaviour of client components visible, and do not have to struggle with Platform::Device instances instantiated multiple times, which care of the lifetime of the device capability internally. Fix genodelabs/genode#4379 --- .../os/src/drivers/platform/session_component.cc | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/repos/os/src/drivers/platform/session_component.cc b/repos/os/src/drivers/platform/session_component.cc index c7b946bde6..5831eee2a5 100644 --- a/repos/os/src/drivers/platform/session_component.cc +++ b/repos/os/src/drivers/platform/session_component.cc @@ -132,15 +132,6 @@ Session_component::acquire_device(Platform::Session::Device_name const &name) { Capability cap; - /* Search for existing, aquired device session */ - _device_registry.for_each([&] (Device_component & dc) { - if (dc.device() == name) - cap = dc.cap(); - }); - - if (cap.valid()) - return cap; - _devices.for_each([&] (Device & dev) { if (dev.name() != name || !matches(dev)) @@ -160,13 +151,6 @@ Session_component::acquire_single_device() { Capability cap; - /* Search for existing, aquired device session */ - _device_registry.for_each([&] (Device_component & dc) { - cap = dc.cap(); }); - - if (cap.valid()) - return cap; - _devices.for_each([&] (Device & dev) { if (matches(dev) && !dev.owner().valid()) cap = _acquire(dev); });