We have to check pointer before usage. Reported-by: Andrey Karpov <karpov at viva64.com> Signed-off-by: Andy Shevchenko <andy.shevchenko at gmail.com> --- drivers/gpu/drm/nouveau/core/subdev/clock/base.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/nouveau/core/subdev/clock/base.c b/drivers/gpu/drm/nouveau/core/subdev/clock/base.c index e51b72d..2e84436 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/clock/base.c +++ b/drivers/gpu/drm/nouveau/core/subdev/clock/base.c @@ -322,7 +322,6 @@ nouveau_pstate_new(struct nouveau_clock *clk, int idx) return 0; pstate = kzalloc(sizeof(*pstate), GFP_KERNEL); - cstate = &pstate->base; if (!pstate) return -ENOMEM; @@ -330,6 +329,9 @@ nouveau_pstate_new(struct nouveau_clock *clk, int idx) pstate->pstate = perfE.pstate; pstate->fanspeed = perfE.fanspeed; + + cstate = &pstate->base; + cstate->voltage = perfE.voltage; cstate->domain[nv_clk_src_core] = perfE.core; cstate->domain[nv_clk_src_shader] = perfE.shader; -- 1.8.3.101.g727a46b