diff options
author | Liav A <liavalb@gmail.com> | 2021-06-18 11:37:26 +0300 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-06-19 09:30:43 +0200 |
commit | 29f9a38f767ee681a8130314aece5a00651d4b5a (patch) | |
tree | 7f7031cb192e0315f02212fb7fceae7ffda18309 /Kernel/Devices/FullDevice.h | |
parent | fba3c77a04f7549dedd0b0e61dcea51bf81e266c (diff) | |
download | serenity-29f9a38f767ee681a8130314aece5a00651d4b5a.zip |
Kernel: Don't use naked new statements in init process
Instead, try to create the device objects in separate static methods,
and if we fail for some odd reason to allocate memory for such devices,
just panic with that reason.
Diffstat (limited to 'Kernel/Devices/FullDevice.h')
-rw-r--r-- | Kernel/Devices/FullDevice.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Kernel/Devices/FullDevice.h b/Kernel/Devices/FullDevice.h index 037b4c7308..2fb8d4e785 100644 --- a/Kernel/Devices/FullDevice.h +++ b/Kernel/Devices/FullDevice.h @@ -13,7 +13,7 @@ namespace Kernel { class FullDevice final : public CharacterDevice { AK_MAKE_ETERNAL public: - FullDevice(); + static NonnullRefPtr<FullDevice> must_create(); virtual ~FullDevice() override; // ^Device @@ -21,6 +21,8 @@ public: virtual String device_name() const override { return "full"; } private: + FullDevice(); + // ^CharacterDevice virtual KResultOr<size_t> read(FileDescription&, u64, UserOrKernelBuffer&, size_t) override; virtual KResultOr<size_t> write(FileDescription&, u64, const UserOrKernelBuffer&, size_t) override; |