mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-19 05:37:54 +00:00
hw: free correct IRQ when closing IRQ session
The ~Irq_session_component relied on the IRQ number obtained by the corresponding kernel IRQ object to mark the IRQ as free at the IRQ allocator. However, since the kernel IRQ object is initialized not before the 'sigh' function is called, the IRQ of sessions that never called 'sigh' could not be freed correctly. This patch fixes the problem by not relying on the kernel IRQ object for obtaining the number in the destructor but using the '_irq_number' member variable instead.
This commit is contained in:
parent
21c7fa2881
commit
281d3ffba9
@ -57,7 +57,7 @@ Irq_session_component::~Irq_session_component()
|
||||
using namespace Kernel;
|
||||
|
||||
User_irq * kirq = reinterpret_cast<User_irq*>(&_kernel_object);
|
||||
_irq_alloc->free((void *)(addr_t)static_cast<Kernel::Irq*>(kirq)->irq_number());
|
||||
_irq_alloc->free((void *)_irq_number);
|
||||
if (_sig_cap.valid())
|
||||
Kernel::delete_irq(kirq);
|
||||
}
|
||||
@ -66,8 +66,7 @@ Irq_session_component::~Irq_session_component()
|
||||
Irq_session_component::Irq_session_component(Range_allocator * const irq_alloc,
|
||||
const char * const args)
|
||||
:
|
||||
_irq_number(Platform::irq(_find_irq_number(args))),
|
||||
_irq_alloc(irq_alloc)
|
||||
_irq_number(Platform::irq(_find_irq_number(args))), _irq_alloc(irq_alloc)
|
||||
{
|
||||
long const msi = Arg_string::find_arg(args, "device_config_phys").long_value(0);
|
||||
if (msi)
|
||||
@ -75,7 +74,7 @@ Irq_session_component::Irq_session_component(Range_allocator * const irq_alloc,
|
||||
|
||||
/* allocate interrupt */
|
||||
if (_irq_alloc->alloc_addr(1, _irq_number).is_error()) {
|
||||
PERR("unavailable interrupt requested");
|
||||
PERR("unavailable interrupt %d requested", _irq_number);
|
||||
throw Root::Invalid_args();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user