{"record":{"id":"de230c4c1ec48c80","repo":"rust-embedded/rust-raspberrypi-OS-tutorials","slug":"no-irq-manager-registered-yet","errorCode":null,"errorMessage":"No IRQ Manager registered yet","messagePattern":"No IRQ Manager registered yet","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"20_timer_callbacks/kernel/src/exception/asynchronous/null_irq_manager.rs","lineNumber":32,"sourceCode":"\n//--------------------------------------------------------------------------------------------------\n// Global instances\n//--------------------------------------------------------------------------------------------------\n\npub static NULL_IRQ_MANAGER: NullIRQManager = NullIRQManager {};\n\n//--------------------------------------------------------------------------------------------------\n// Public Code\n//--------------------------------------------------------------------------------------------------\n\nimpl interface::IRQManager for NullIRQManager {\n    type IRQNumberType = super::IRQNumber;\n\n    fn register_handler(\n        &self,\n        _descriptor: IRQHandlerDescriptor<Self::IRQNumberType>,\n    ) -> Result<(), &'static str> {\n        panic!(\"No IRQ Manager registered yet\");\n    }\n\n    fn enable(&self, _irq_number: &Self::IRQNumberType) {\n        panic!(\"No IRQ Manager registered yet\");\n    }\n\n    fn handle_pending_irqs<'irq_context>(&'irq_context self, _ic: &IRQContext<'irq_context>) {\n        panic!(\"No IRQ Manager registered yet\");\n    }\n}\n","sourceCodeStart":14,"sourceCodeEnd":43,"githubUrl":"https://github.com/rust-embedded/rust-raspberrypi-OS-tutorials/blob/644474cc09f755249f9c55d99a5d1e07a2562fc7/20_timer_callbacks/kernel/src/exception/asynchronous/null_irq_manager.rs#L14-L43","documentation":"The null IRQ manager is a placeholder implementing the InterruptController trait whose every method panics. Its purpose is to act as a stand-in so trait plumbing compiles before a real interrupt controller is installed; encountering this panic means driver code attempted to register or enable an IRQ while no real IRQ manager has been set as the system-wide controller.","triggerScenarios":"A driver calls register_handler() (or enable()) on the null IRQ manager — i.e. the global IRQ manager reference still points to NullIRQManager because no real controller was registered before driver IRQ setup ran.","commonSituations":"Calling init_drivers_and_irqs() (or drivers doing IRQ setup in post_init) before the kernel sets the real interrupt controller; forgetting the 'register IRQ manager' step in the board bring-up sequence; running on a target whose interrupt-controller init was skipped or failed silently.","solutions":["Register the real interrupt controller (e.g. GICv2/Bcm IRQ manager) as the system IRQ manager before initializing drivers.","Reorder boot so that IRQ-manager setup happens prior to any init that registers IRQ handlers.","Check that the interrupt-controller driver's own init succeeded; if it failed earlier, subsequent registration hits the null manager.","For code that intentionally has no interrupt controller, remove IRQ registration paths instead of relying on the null manager."],"exampleFix":"// before\nunsafe { driver_manager().init_drivers_and_irqs() };\n// real IRQ manager never registered -> drivers hit NullIRQManager\n\n// after\nlet gic = &gicv2::GICv2::new(gicd_base, gicc_base);\ngic.register_kernel_irq_manager(); // install real controller first\nunsafe { driver_manager().init_drivers_and_irqs() };","handlingStrategy":"validation","validationCode":"// check a real controller is installed before any IRQ registration:\nif !irq_manager_registered() {\n    return Err(\"IRQ manager not registered: cannot register handler\");\n}","typeGuard":"fn is_null_manager(m: &dyn InterruptController<IRQNumberType = IRQNumber>) -> bool {\n    // null manager is a zero-sized placeholder; track installation with a flag\n    !IRQ_MANAGER_INSTALLED.load(Ordering::Acquire)\n}","tryCatchPattern":"// panics cannot be caught in no_std kernel; fail early instead:\nassert!(irq_manager_registered(), \"call register_kernel_irq_manager() before driver init\");","preventionTips":["Always call register_kernel_irq_manager() (or equivalent) as the first step of interrupt bring-up.","Enforce boot ordering with a state machine that refuses driver init before the controller is set.","Never ship code paths that intentionally call the null manager; treat it as compile/plumbing scaffolding only."],"tags":["rust","irq","interrupt-controller","panic","initialization-order"],"backgroundTag":"missing-configuration","analyzedSha":"644474cc09f755249f9c55d99a5d1e07a2562fc7","analyzedAt":"2026-09-06T09:25:56.584Z","contentChangedAt":"2026-09-06T09:25:56.584Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}