From b4e86cc499ca385938a1831ffcf29593c5efca65 Mon Sep 17 00:00:00 2001 From: Alexander Boettcher Date: Tue, 17 Jun 2014 13:54:06 +0200 Subject: [PATCH] ahci: throw exception if device can not be found Fixes #1183 --- repos/os/src/drivers/ahci/x86/ahci_driver.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/repos/os/src/drivers/ahci/x86/ahci_driver.h b/repos/os/src/drivers/ahci/x86/ahci_driver.h index 105a48d6c..289e6d876 100644 --- a/repos/os/src/drivers/ahci/x86/ahci_driver.h +++ b/repos/os/src/drivers/ahci/x86/ahci_driver.h @@ -42,7 +42,16 @@ class Ahci_driver : public Ahci_pci_connection, /** * Constructor */ - Ahci_driver() : Ahci_driver_base(Ahci_device::probe(_pci)) { } + Ahci_driver() : Ahci_driver_base(nullptr) { + Ahci_device * device = Ahci_device::probe(_pci); + + if (!device) { + PWRN("Could not find ahci device"); + throw Root::Unavailable(); + } + + _device = device; + } }; #endif /* _AHCI_DRIVER_H_ */