mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 17:38:12 +00:00
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.
This commit is contained in:
parent
fba3c77a04
commit
29f9a38f76
11 changed files with 74 additions and 18 deletions
|
@ -5,10 +5,16 @@
|
|||
*/
|
||||
|
||||
#include <Kernel/Devices/RandomDevice.h>
|
||||
#include <Kernel/Panic.h>
|
||||
#include <Kernel/Random.h>
|
||||
|
||||
namespace Kernel {
|
||||
|
||||
UNMAP_AFTER_INIT NonnullRefPtr<RandomDevice> RandomDevice::must_create()
|
||||
{
|
||||
return adopt_ref_if_nonnull(new RandomDevice).release_nonnull();
|
||||
}
|
||||
|
||||
UNMAP_AFTER_INIT RandomDevice::RandomDevice()
|
||||
: CharacterDevice(1, 8)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue