mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] efi: skip devices without driver in efi_pause/continue_devices()
@ 2022-01-18 13:43 Philipp Zabel
  2022-01-18 15:14 ` Michael Olbrich
  2022-01-20  8:33 ` Sascha Hauer
  0 siblings, 2 replies; 3+ messages in thread
From: Philipp Zabel @ 2022-01-18 13:43 UTC (permalink / raw)
  To: barebox

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@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


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] efi: skip devices without driver in efi_pause/continue_devices()
  2022-01-18 13:43 [PATCH] efi: skip devices without driver in efi_pause/continue_devices() Philipp Zabel
@ 2022-01-18 15:14 ` Michael Olbrich
  2022-01-20  8:33 ` Sascha Hauer
  1 sibling, 0 replies; 3+ messages in thread
From: Michael Olbrich @ 2022-01-18 15:14 UTC (permalink / raw)
  To: Philipp Zabel; +Cc: barebox

On Tue, Jan 18, 2022 at 02:43:17PM +0100, Philipp Zabel wrote:
> 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@pengutronix.de>

Tested-by: Michael Olbrich <m.olbrich@pengutronix.de>

Regards,
Michael

> ---
>  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
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] efi: skip devices without driver in efi_pause/continue_devices()
  2022-01-18 13:43 [PATCH] efi: skip devices without driver in efi_pause/continue_devices() Philipp Zabel
  2022-01-18 15:14 ` Michael Olbrich
@ 2022-01-20  8:33 ` Sascha Hauer
  1 sibling, 0 replies; 3+ messages in thread
From: Sascha Hauer @ 2022-01-20  8:33 UTC (permalink / raw)
  To: Philipp Zabel; +Cc: barebox

On Tue, Jan 18, 2022 at 02:43:17PM +0100, Philipp Zabel wrote:
> 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@pengutronix.de>
> ---
>  drivers/efi/efi-device.c | 14 ++++++++++++--
>  1 file changed, 12 insertions(+), 2 deletions(-)

Applied, thanks

I wonder how this could work here, I think there are many devices
without a driver in every EFI barebox.

Sascha

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-01-20  8:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-18 13:43 [PATCH] efi: skip devices without driver in efi_pause/continue_devices() Philipp Zabel
2022-01-18 15:14 ` Michael Olbrich
2022-01-20  8:33 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox