aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/bcm27xx/patches-5.15/950-0879-drm-vc4_kms-Protect-hvs-dereference-on-fkms.patch
blob: 12e6318e53f39c941cce431acee4f036e4da0fce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
From 02e41ddac8a960df7defaa377c1d3d981ac0a652 Mon Sep 17 00:00:00 2001
From: Dom Cobley <popcornmix@gmail.com>
Date: Wed, 27 Apr 2022 14:45:35 +0100
Subject: [PATCH] drm/vc4_kms: Protect hvs dereference on fkms

fkms has a null hvs pointer so this crashes. Protect against it

Signed-off-by: Dom Cobley <popcornmix@gmail.com>
---
 drivers/gpu/drm/vc4/vc4_kms.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/gpu/drm/vc4/vc4_kms.c
+++ b/drivers/gpu/drm/vc4/vc4_kms.c
@@ -354,7 +354,7 @@ static void vc4_atomic_commit_tail(struc
 	struct vc4_hvs_state *new_hvs_state;
 	struct drm_crtc *crtc;
 	struct vc4_hvs_state *old_hvs_state;
-	unsigned long max_clock_rate = clk_get_max_rate(hvs->core_clk);
+	unsigned long max_clock_rate = hvs ? clk_get_max_rate(hvs->core_clk) : 0;
 	unsigned int channel;
 	int i;