[bug report] drm/amdgpu: move debugfs functions to their own file
Dan Carpenter
dan.carpenter at oracle.com
Mon Jan 8 13:12:58 UTC 2018
[ Not really a new bug, but moving the function makes it show up as a
new bug. - dan ]
Hello Alex Deucher,
The patch 75758255dc0f: "drm/amdgpu: move debugfs functions to their
own file" from Dec 14, 2017, leads to the following static checker
warning:
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:696 amdgpu_debugfs_regs_init()
warn: possible NULL dereference of 'ent'
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
677 int amdgpu_debugfs_regs_init(struct amdgpu_device *adev)
678 {
679 struct drm_minor *minor = adev->ddev->primary;
680 struct dentry *ent, *root = minor->debugfs_root;
681 unsigned i, j;
682
683 for (i = 0; i < ARRAY_SIZE(debugfs_regs); i++) {
684 ent = debugfs_create_file(debugfs_regs_names[i],
685 S_IFREG | S_IRUGO, root,
686 adev, debugfs_regs[i]);
687 if (IS_ERR(ent)) {
688 for (j = 0; j < i; j++) {
689 debugfs_remove(adev->debugfs_regs[i]);
690 adev->debugfs_regs[i] = NULL;
691 }
692 return PTR_ERR(ent);
693 }
694
695 if (!i)
696 i_size_write(ent->d_inode, adev->rmmio_size);
^^^^^^^^^^^^
debugfs_create_file() returns ERR_PTR(-ENODEV) if it's not enabled in
the .config or it returns a NULL pointer.
697 adev->debugfs_regs[i] = ent;
698 }
699
700 return 0;
701 }
regards,
dan carpenter
More information about the amd-gfx
mailing list