mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 12:12:45 +00:00 
			
		
		
		
	Kernel/VirtIO: Use proper error propagation from the get_config method
This allows us to drop null-checks at call-sites, thus simplifying the code and reducing the chance of nullptr-dereference errors.
This commit is contained in:
		
							parent
							
								
									87a32ab869
								
							
						
					
					
						commit
						bc3eb6d65f
					
				
					 4 changed files with 7 additions and 11 deletions
				
			
		|  | @ -22,9 +22,7 @@ UNMAP_AFTER_INIT NonnullLockRefPtr<Console> Console::must_create(PCI::DeviceIden | |||
| UNMAP_AFTER_INIT ErrorOr<void> Console::initialize_virtio_resources() | ||||
| { | ||||
|     TRY(Device::initialize_virtio_resources()); | ||||
|     auto const* cfg = get_config(VirtIO::ConfigurationType::Device); | ||||
|     if (!cfg) | ||||
|         return Error::from_errno(ENODEV); | ||||
|     auto const* cfg = TRY(get_config(VirtIO::ConfigurationType::Device)); | ||||
|     bool success = negotiate_features([&](u64 supported_features) { | ||||
|         u64 negotiated = 0; | ||||
|         if (is_feature_set(supported_features, VIRTIO_CONSOLE_F_SIZE)) | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Liav A
						Liav A