Skip to contentSkip to conversation

drm/msm/a6xx: Fix a size determination in a6xx_get_indexed_registers()

PATCH In review Zhenzhong Duan 2 participants 2 messages Sep 14, 2020 – Sep 23, 2020

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 drm/msm/a6xx: Fix a size determination in a6xx_get_indexed_registers()

It's allocating an array of a6xx_gpu_state_obj structure rather than its pointers.

Fixes d6852b4b2d01 ("drm/msm/a6xx: Track and manage a6xx state memory")

---
v2: Update commit message per Markus, thanks

 drivers/gpu/drm/msm/adreno/a6xx_gpu_state.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/msm/adreno/a6xx_gpu_state.c +1 -1
index b12f5b4..e9ede19 100644
@@ -875,7 +875,7 @@ static void a6xx_get_indexed_registers(struct msm_gpu *gpu,
 	int i;
 
 	a6xx_state->indexed_regs = state_kcalloc(a6xx_state, count,
-		sizeof(a6xx_state->indexed_regs));
+		sizeof(*a6xx_state->indexed_regs));
 	if (!a6xx_state->indexed_regs)
 		return;
 
Signature · 1 line
1.8.3.1
Reviewed-by on v2 1/1
#1 lore raw
Quoted 5 lines · Zhenzhong Duan

It's allocating an array of a6xx_gpu_state_obj structure rather than its pointers.

Fixes d6852b4b2d01 ("drm/msm/a6xx: Track and manage a6xx state memory")
Quoted 22 lines

---
v2: Update commit message per Markus, thanks

 drivers/gpu/drm/msm/adreno/a6xx_gpu_state.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/msm/adreno/a6xx_gpu_state.c +1 -1
index b12f5b4..e9ede19 100644
@@ -875,7 +875,7 @@ static void a6xx_get_indexed_registers(struct msm_gpu *gpu,
 	int i;
 
 	a6xx_state->indexed_regs = state_kcalloc(a6xx_state, count,
-		sizeof(a6xx_state->indexed_regs));
+		sizeof(*a6xx_state->indexed_regs));
 	if (!a6xx_state->indexed_regs)
 		return;
 
Signature · 1 line
1.8.3.1
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project