1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-28 17:25:06 +00:00

Kernel: Assert that device major/minor hasn't already been registered

It would be a bug to have multiple devices with the same major/minor
so let's have an assertion for that.
This commit is contained in:
Andreas Kling 2019-12-09 15:51:10 +01:00
parent 8621304447
commit 2e38df7bd1

View file

@ -29,7 +29,9 @@ Device::Device(unsigned major, unsigned minor)
: m_major(major)
, m_minor(minor)
{
all_devices().set(encoded_device(m_major, m_minor), this);
u32 device_id = encoded_device(major, minor);
ASSERT(!all_devices().contains(device_id));
all_devices().set(device_id, this);
}
Device::~Device()