Commit 7bed1df8 authored by Eric Huang's avatar Eric Huang Committed by Alex Deucher

drm/amdgpu: fix NULL pointer in amdgpu_reset_get_desc

amdgpu_job_ring may return NULL, which causes kernel NULL
pointer error, using another way to print ring name instead
of ring->name.
Suggested-by: default avatarLijo Lazar <Lijo.Lazar@amd.com>
Signed-off-by: default avatarEric Huang <jinhuieric.huang@amd.com>
Acked-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Reviewed-by: default avatarLijo Lazar <lijo.lazar@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 6218bd6b
...@@ -164,16 +164,14 @@ void amdgpu_device_unlock_reset_domain(struct amdgpu_reset_domain *reset_domain) ...@@ -164,16 +164,14 @@ void amdgpu_device_unlock_reset_domain(struct amdgpu_reset_domain *reset_domain)
void amdgpu_reset_get_desc(struct amdgpu_reset_context *rst_ctxt, char *buf, void amdgpu_reset_get_desc(struct amdgpu_reset_context *rst_ctxt, char *buf,
size_t len) size_t len)
{ {
struct amdgpu_ring *ring;
if (!buf || !len) if (!buf || !len)
return; return;
switch (rst_ctxt->src) { switch (rst_ctxt->src) {
case AMDGPU_RESET_SRC_JOB: case AMDGPU_RESET_SRC_JOB:
if (rst_ctxt->job) { if (rst_ctxt->job) {
ring = amdgpu_job_ring(rst_ctxt->job); snprintf(buf, len, "job hang on ring:%s",
snprintf(buf, len, "job hang on ring:%s", ring->name); rst_ctxt->job->base.sched->name);
} else { } else {
strscpy(buf, "job hang", len); strscpy(buf, "job hang", len);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment