[drm-misc:for-linux-next 5/10] drivers/gpu/drm/drm_file.c:967 drm_show_memory_stats() error: uninitialized symbol 'supported_status'.
Dan Carpenter
dan.carpenter at linaro.org
Fri May 26 04:20:53 UTC 2023
tree: git://anongit.freedesktop.org/drm/drm-misc for-linux-next
head: dd9e329af7236e34c566d3705ea32a63069b9b13
commit: 686b21b5f6ca2f8a716f9a4ade07246dbfb2713e [5/10] drm: Add fdinfo memory stats
config: x86_64-randconfig-m001-20230524
compiler: gcc-11 (Debian 11.3.0-12) 11.3.0
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp at intel.com>
| Reported-by: Dan Carpenter <error27 at gmail.com>
| Closes: https://lore.kernel.org/r/202305260440.7dv6FZHq-lkp@intel.com/
smatch warnings:
drivers/gpu/drm/drm_file.c:967 drm_show_memory_stats() error: uninitialized symbol 'supported_status'.
vim +/supported_status +967 drivers/gpu/drm/drm_file.c
686b21b5f6ca2f Rob Clark 2023-05-24 923 void drm_show_memory_stats(struct drm_printer *p, struct drm_file *file)
686b21b5f6ca2f Rob Clark 2023-05-24 924 {
686b21b5f6ca2f Rob Clark 2023-05-24 925 struct drm_gem_object *obj;
686b21b5f6ca2f Rob Clark 2023-05-24 926 struct drm_memory_stats status = {};
686b21b5f6ca2f Rob Clark 2023-05-24 927 enum drm_gem_object_status supported_status;
686b21b5f6ca2f Rob Clark 2023-05-24 928 int id;
686b21b5f6ca2f Rob Clark 2023-05-24 929
686b21b5f6ca2f Rob Clark 2023-05-24 930 spin_lock(&file->table_lock);
686b21b5f6ca2f Rob Clark 2023-05-24 931 idr_for_each_entry (&file->object_idr, obj, id) {
686b21b5f6ca2f Rob Clark 2023-05-24 932 enum drm_gem_object_status s = 0;
686b21b5f6ca2f Rob Clark 2023-05-24 933
686b21b5f6ca2f Rob Clark 2023-05-24 934 if (obj->funcs && obj->funcs->status) {
686b21b5f6ca2f Rob Clark 2023-05-24 935 s = obj->funcs->status(obj);
686b21b5f6ca2f Rob Clark 2023-05-24 936 supported_status = DRM_GEM_OBJECT_RESIDENT |
686b21b5f6ca2f Rob Clark 2023-05-24 937 DRM_GEM_OBJECT_PURGEABLE;
Smatch is concerned that we might not hit this assignment. That seems
reasonable, because otherwise why not hard code it at the start?
686b21b5f6ca2f Rob Clark 2023-05-24 938 }
686b21b5f6ca2f Rob Clark 2023-05-24 939
686b21b5f6ca2f Rob Clark 2023-05-24 940 if (obj->handle_count > 1) {
686b21b5f6ca2f Rob Clark 2023-05-24 941 status.shared += obj->size;
686b21b5f6ca2f Rob Clark 2023-05-24 942 } else {
686b21b5f6ca2f Rob Clark 2023-05-24 943 status.private += obj->size;
686b21b5f6ca2f Rob Clark 2023-05-24 944 }
686b21b5f6ca2f Rob Clark 2023-05-24 945
686b21b5f6ca2f Rob Clark 2023-05-24 946 if (s & DRM_GEM_OBJECT_RESIDENT) {
686b21b5f6ca2f Rob Clark 2023-05-24 947 status.resident += obj->size;
686b21b5f6ca2f Rob Clark 2023-05-24 948 } else {
686b21b5f6ca2f Rob Clark 2023-05-24 949 /* If already purged or not yet backed by pages, don't
686b21b5f6ca2f Rob Clark 2023-05-24 950 * count it as purgeable:
686b21b5f6ca2f Rob Clark 2023-05-24 951 */
686b21b5f6ca2f Rob Clark 2023-05-24 952 s &= ~DRM_GEM_OBJECT_PURGEABLE;
686b21b5f6ca2f Rob Clark 2023-05-24 953 }
686b21b5f6ca2f Rob Clark 2023-05-24 954
686b21b5f6ca2f Rob Clark 2023-05-24 955 if (!dma_resv_test_signaled(obj->resv, dma_resv_usage_rw(true))) {
686b21b5f6ca2f Rob Clark 2023-05-24 956 status.active += obj->size;
686b21b5f6ca2f Rob Clark 2023-05-24 957
686b21b5f6ca2f Rob Clark 2023-05-24 958 /* If still active, don't count as purgeable: */
686b21b5f6ca2f Rob Clark 2023-05-24 959 s &= ~DRM_GEM_OBJECT_PURGEABLE;
686b21b5f6ca2f Rob Clark 2023-05-24 960 }
686b21b5f6ca2f Rob Clark 2023-05-24 961
686b21b5f6ca2f Rob Clark 2023-05-24 962 if (s & DRM_GEM_OBJECT_PURGEABLE)
686b21b5f6ca2f Rob Clark 2023-05-24 963 status.purgeable += obj->size;
686b21b5f6ca2f Rob Clark 2023-05-24 964 }
686b21b5f6ca2f Rob Clark 2023-05-24 965 spin_unlock(&file->table_lock);
686b21b5f6ca2f Rob Clark 2023-05-24 966
686b21b5f6ca2f Rob Clark 2023-05-24 @967 drm_print_memory_stats(p, &status, supported_status, "memory");
686b21b5f6ca2f Rob Clark 2023-05-24 968 }
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
More information about the dri-devel
mailing list