On 27.07.23 08:05, Marco Felsch wrote: > On 23-07-26, Ahmad Fatoum wrote: >> HAB code calls into OCOTP driver by relying on a global imx_ocotp >> variable that's populated on driver probe. >> >> For board code that calls a HAB function to early, this may end up >> dereferencing a NULL pointer, so let's return -EPROBE_DEFER in that >> case or if deep probe is enabled, just probe the OCOTP directly. >> >> Signed-off-by: Ahmad Fatoum <a.fatoum@xxxxxxxxxxxxxx> >> --- >> @@ -497,11 +498,17 @@ static void imx_ocotp_field_decode(uint32_t field, unsigned *word, >> *mask = GENMASK(width, 0); >> } >> >> +static int imx_ocotp_ensure_probed(void); > > Nit: Move the function definition here? Then I'd have to forward-declare imx_ocotp_dt_ids. I choose to keep the probing stuff together. >> +static int imx_ocotp_ensure_probed(void) >> +{ >> + if (!imx_ocotp && deep_probe_is_supported()) { >> + int ret; >> + >> + ret = of_devices_ensure_probed_by_dev_id(imx_ocotp_dt_ids); >> + if (ret) >> + return ret; >> + } >> + >> + return imx_ocotp ? 0 : -EPROBE_DEFER; >> +} >> + -- 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 |