Re: [PATCH v4 3/4] firmware: raspberrypi: Add reboot mode support

From: Stefan Wahren

Date: Fri Sep 04 2026 - 14:00:23 EST


Am 04.09.26 um 09:46 schrieb Gregor Herburger:
The Raspberry Pi firmware has a tryboot mode where it tries to boot from
another partition. This can be used to create a A/B update scheme.

To enable this on the next boot, the RPI_FIRMWARE_SET_REBOOT_FLAGS
message must be sent to the firmware. Add support for this by
registering a reboot mode driver.

Furthermore, safely registering the reboot mode requires adjusting the
teardown sequence. Replace the manually called rpi_firmware_put() with a
devres-managed called (devm_add_action_or_reset). Without this, the
cleanup function of devm_reboot_mode_register() would trigger a
use-after-free error by attempting to access the firmware context after
it had already been freed by rpi_firmware_remove().

Signed-off-by: Gregor Herburger <gregor.herburger@xxxxxxxxxxxxx>
Tested-by: Stefan Wahren <wahrenst@xxxxxxx>

I tested with a Raspberry Pi 3 B Plus i didn't see any regressions

also the code looks fine to me