@@ -87,14 +87,11 @@ static ssize_t kfd_procfs_show(struct kobject *kobj, struct attribute *attr,
} else if (strncmp(attr->name, "vram_", 5) == 0) {
struct kfd_process_device *pdd = container_of(attr, struct kfd_process_device,
attr_vram);
- if (pdd)
- return snprintf(buffer, PAGE_SIZE, "%llu\n", READ_ONCE(pdd->vram_usage));
+ return snprintf(buffer, PAGE_SIZE, "%llu\n", READ_ONCE(pdd->vram_usage));
} else {
pr_err("Invalid attribute");
return -EINVAL;
}
-
- return 0;
}
static void kfd_procfs_kobj_release(struct kobject *kobj)
container_of is never null, so the null check on pdd is unnecessary. If the null check is removed, function kfd_procfs_show() will always return before reaching "return 0", hence such return is logically dead. So, remove it, as well. Addresses-Coverity-ID: 1492793 ("Logically dead code") Fixes: d4566dee849e ("drm/amdkfd: Track GPU memory utilization per process") Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com> --- drivers/gpu/drm/amd/amdkfd/kfd_process.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)