Skip to contentSkip to conversation

media: i2c: ov8856: fix debug message to report actual CSI-2 lane count

PATCH In review Serin Yeh 1 participant 1 message Aug 6

Subsystems (4)
lore
Share & tools
lore

Serin Yeh

author
#0 lore raw

PATCH v4 2/2 media: i2c: ov8856: fix debug message to report actual CSI-2 lane count

The driver currently prints the number of data lanes using ov8856->cur_mode->data_lanes in ov8856_get_hwcfg(). However, the ov8856->cur_mode structure is not assigned to a clearly supported mode at that point. Due to the missing pointer, enabling dynamic debug may lead to a kernel panic.

Instead, the correct number of CSI-2 data lanes should be taken from bus_cfg.bus.mipi_csi2.num_data_lanes, which represents the real hardware configuration determined at runtime.

Fixes c492ec9ae9ed ("media: ov8856: Add support for 2 data lanes")
---
 drivers/media/i2c/ov8856.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/media/i2c/ov8856.c +2 -1
index 9d2b0469a576..6011233a218d 100644
@@ -2318,7 +2318,8 @@ static int ov8856_get_hwcfg(struct ov8856 *ov8856)
 		goto check_hwcfg_error;
 	}
 
-	dev_dbg(dev, "Using %u data lanes\n", ov8856->cur_mode->data_lanes);
+	dev_dbg(dev, "Using %u data lanes\n",
+		bus_cfg.bus.mipi_csi2.num_data_lanes);
 
 	if (bus_cfg.bus.mipi_csi2.num_data_lanes == 2)
 		ov8856->priv_lane = &lane_cfg_2;
Signature · 1 line
2.25.1