[PATCH] dm: core: Don't allow ofnode_to_fdt() to return NULL

Tom Rini trini at konsulko.com
Mon Feb 16 18:50:20 CET 2026


On Tue, Feb 10, 2026 at 05:29:01PM +0100, Romain Gantois wrote:

> The ofnode_to_fdt() function may return a NULL pointer in multiple cases.
> Or, this function's return value is often passed directly to functions such
> as fdt_getprop() which end up dereferencing it, thus causing a NULL pointer
> exception.
> 
> Don't allow ofnode_to_fdt() to return NULL, to avoid a NULL pointer
> dereference.
> 
> Signed-off-by: Romain Gantois <romain.gantois at bootlin.com>

This leads to failures to build such as:
+(neu6a-io-rk3588) drivers/core/ofnode.c: In function 'ofnode_to_fdt':
+(neu6a-io-rk3588) drivers/core/ofnode.c:176:21: error: assignment discards 'const' qualifie  from pointer target type [-Werror=discarded-qualifiers]
+(neu6a-io-rk3588)   176 |                 fdt = gd->fdt_blob;
+(neu6a-io-rk3588)       |                     ^
+(neu6a-io-rk3588) cc1: all warnings being treated as errors

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20260216/c506419d/attachment.sig>


More information about the U-Boot mailing list