[PATCH] efi: skip devices without driver in efi_pause/continue_devices()

Philipp Zabel p.zabel at pengutronix.de
Tue Jan 18 05:43:17 PST 2022


Skip devices on the EFI bus that do not have a driver assigned.

Fixes: f68a547deebd ("efi: add efi_device hook to be called before an image is started")
Signed-off-by: Philipp Zabel <p.zabel at pengutronix.de>
---
 drivers/efi/efi-device.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/drivers/efi/efi-device.c b/drivers/efi/efi-device.c
index 39724ec2f431..f91d09e8eaa5 100644
--- a/drivers/efi/efi-device.c
+++ b/drivers/efi/efi-device.c
@@ -473,7 +473,12 @@ void efi_pause_devices(void)
 	bus_for_each_device(&efi_bus, dev) {
 		struct driver_d *drv = dev->driver;
 		struct efi_device *efidev = to_efi_device(dev);
-		struct efi_driver *efidrv = to_efi_driver(drv);
+		struct efi_driver *efidrv;
+
+		if (!drv)
+			continue;
+
+		efidrv = to_efi_driver(drv);
 
 		if (efidrv->dev_pause)
 			efidrv->dev_pause(efidev);
@@ -487,7 +492,12 @@ void efi_continue_devices(void)
 	bus_for_each_device(&efi_bus, dev) {
 		struct driver_d *drv = dev->driver;
 		struct efi_device *efidev = to_efi_device(dev);
-		struct efi_driver *efidrv = to_efi_driver(drv);
+		struct efi_driver *efidrv;
+
+		if (!drv)
+			continue;
+
+		efidrv = to_efi_driver(drv);
 
 		if (efidrv->dev_continue)
 			efidrv->dev_continue(efidev);
-- 
2.30.2




More information about the barebox mailing list