[19/33] video: stm32: lvds: fix NULL pointer dereference on missing data-mapping

Message ID 20261104085036.4012238-20-dario.binacchi@amarulasolutions.com
State New
Headers
Series Add Engicam MicroGEA-STM32MP257D-RMM board support |

Commit Message

Dario Binacchi Nov. 4, 2026, 8:49 a.m. UTC
The "data-mapping" property is only required by the panel-lvds binding,
so ofnode_read_string() may return NULL. Avoid a NULL pointer
dereference in this case by falling back to the VESA mapping, as for any
value other than "jeida-24".

Fixes: 16cfbbbe2b51 ("video: stm32: STM32 driver support for LVDS")
Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
---

 drivers/video/stm32/stm32_lvds.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

-- 
2.43.0
  

Patch

diff --git a/drivers/video/stm32/stm32_lvds.c b/drivers/video/stm32/stm32_lvds.c
index bf1393c9e872..a16331296388 100644
--- a/drivers/video/stm32/stm32_lvds.c
+++ b/drivers/video/stm32/stm32_lvds.c
@@ -614,9 +614,7 @@  static int stm32_lvds_of_to_plat(struct udevice *dev)
 	}
 
 	data_mapping = ofnode_read_string(dev_ofnode(plat->panel), "data-mapping");
-	if (!strcmp(data_mapping, "vesa-24"))
-		priv->bus_format = MEDIA_BUS_FMT_RGB888_1X7X4_SPWG;
-	else if (!strcmp(data_mapping, "jeida-24"))
+	if (data_mapping && !strcmp(data_mapping, "jeida-24"))
 		priv->bus_format = MEDIA_BUS_FMT_RGB888_1X7X4_JEIDA;
 	else
 		priv->bus_format = MEDIA_BUS_FMT_RGB888_1X7X4_SPWG;