All of lore.kernel.org
 help / color / mirror / Atom feed
* [linux-next:master 13146/13293] drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:623 dm_vupdate_high_irq() warn: variable dereferenced before check 'acrtc->dm_irq_params.stream' (see line 615)
@ 2025-08-06  1:32 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2025-08-06  1:32 UTC (permalink / raw)
  To: oe-kbuild; +Cc: lkp, Dan Carpenter

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
TO: Aurabindo Pillai <aurabindo.pillai@amd.com>
CC: Alex Deucher <alexander.deucher@amd.com>
CC: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
CC: Ray Wu <ray.wu@amd.com>
CC: Roman Li <roman.li@amd.com>
CC: ChiaHsuan Chung <chiahsuan.chung@amd.com>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   afec768a6a8fe7fb02a08ffce5f2f556f51d4b52
commit: 6d31602a9f57a7bb3c6c8dbde1d00af67e250a3f [13146/13293] drm/amd/display: more liberal vmin/vmax update for freesync
:::::: branch date: 22 hours ago
:::::: commit date: 31 hours ago
config: xtensa-randconfig-r071-20250805 (https://download.01.org/0day-ci/archive/20250806/202508060905.UfJvsVLK-lkp@intel.com/config)
compiler: xtensa-linux-gcc (GCC) 8.5.0

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Dan Carpenter <error27@gmail.com>
| Closes: https://lore.kernel.org/r/202508060905.UfJvsVLK-lkp@intel.com/

New smatch warnings:
drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:623 dm_vupdate_high_irq() warn: variable dereferenced before check 'acrtc->dm_irq_params.stream' (see line 615)

Old smatch warnings:
drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:6036 fill_dc_dirty_rects() warn: iterator 'i' not incremented
drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:12509 parse_edid_displayid_vrr() warn: variable dereferenced before check 'edid_ext' (see line 12505)

vim +623 drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c

c210b757b40095 Aurabindo Pillai 2025-07-21  576  
d2574c33bb7195 Mario Kleiner    2019-03-29  577  static void dm_vupdate_high_irq(void *interrupt_params)
d2574c33bb7195 Mario Kleiner    2019-03-29  578  {
d2574c33bb7195 Mario Kleiner    2019-03-29  579  	struct common_irq_params *irq_params = interrupt_params;
d2574c33bb7195 Mario Kleiner    2019-03-29  580  	struct amdgpu_device *adev = irq_params->adev;
d2574c33bb7195 Mario Kleiner    2019-03-29  581  	struct amdgpu_crtc *acrtc;
4758823355a0ed Rodrigo Siqueira 2021-03-10  582  	struct drm_device *drm_dev;
4758823355a0ed Rodrigo Siqueira 2021-03-10  583  	struct drm_vblank_crtc *vblank;
4758823355a0ed Rodrigo Siqueira 2021-03-10  584  	ktime_t frame_duration_ns, previous_timestamp;
09aef2c48e799b Mario Kleiner    2019-04-26  585  	unsigned long flags;
585d450c76d1d5 Aurabindo Pillai 2020-08-12  586  	int vrr_active;
d2574c33bb7195 Mario Kleiner    2019-03-29  587  
d2574c33bb7195 Mario Kleiner    2019-03-29  588  	acrtc = get_crtc_by_otg_inst(adev, irq_params->irq_src - IRQ_TYPE_VUPDATE);
d2574c33bb7195 Mario Kleiner    2019-03-29  589  
d2574c33bb7195 Mario Kleiner    2019-03-29  590  	if (acrtc) {
6c5e25a0255d56 David Tadokoro   2023-03-07  591  		vrr_active = amdgpu_dm_crtc_vrr_active_irq(acrtc);
4758823355a0ed Rodrigo Siqueira 2021-03-10  592  		drm_dev = acrtc->base.dev;
d26238c6806d56 Ville Syrjälä    2024-04-08  593  		vblank = drm_crtc_vblank_crtc(&acrtc->base);
4758823355a0ed Rodrigo Siqueira 2021-03-10  594  		previous_timestamp = atomic64_read(&irq_params->previous_timestamp);
4758823355a0ed Rodrigo Siqueira 2021-03-10  595  		frame_duration_ns = vblank->time - previous_timestamp;
4758823355a0ed Rodrigo Siqueira 2021-03-10  596  
4758823355a0ed Rodrigo Siqueira 2021-03-10  597  		if (frame_duration_ns > 0) {
4758823355a0ed Rodrigo Siqueira 2021-03-10  598  			trace_amdgpu_refresh_rate_track(acrtc->base.index,
4758823355a0ed Rodrigo Siqueira 2021-03-10  599  						frame_duration_ns,
4758823355a0ed Rodrigo Siqueira 2021-03-10  600  						ktime_divns(NSEC_PER_SEC, frame_duration_ns));
4758823355a0ed Rodrigo Siqueira 2021-03-10  601  			atomic64_set(&irq_params->previous_timestamp, vblank->time);
4758823355a0ed Rodrigo Siqueira 2021-03-10  602  		}
d2574c33bb7195 Mario Kleiner    2019-03-29  603  
5d72e247e58c96 Hamza Mahfooz    2023-09-20  604  		drm_dbg_vbl(drm_dev,
5d72e247e58c96 Hamza Mahfooz    2023-09-20  605  			    "crtc:%d, vupdate-vrr:%d\n", acrtc->crtc_id,
585d450c76d1d5 Aurabindo Pillai 2020-08-12  606  			    vrr_active);
d2574c33bb7195 Mario Kleiner    2019-03-29  607  
d2574c33bb7195 Mario Kleiner    2019-03-29  608  		/* Core vblank handling is done here after end of front-porch in
d2574c33bb7195 Mario Kleiner    2019-03-29  609  		 * vrr mode, as vblank timestamping will give valid results
d2574c33bb7195 Mario Kleiner    2019-03-29  610  		 * while now done after front-porch. This will also deliver
d2574c33bb7195 Mario Kleiner    2019-03-29  611  		 * page-flip completion events that have been queued to us
d2574c33bb7195 Mario Kleiner    2019-03-29  612  		 * if a pageflip happened inside front-porch.
d2574c33bb7195 Mario Kleiner    2019-03-29  613  		 */
585d450c76d1d5 Aurabindo Pillai 2020-08-12  614  		if (vrr_active) {
6d31602a9f57a7 Aurabindo Pillai 2025-04-16 @615  			bool replay_en = acrtc->dm_irq_params.stream->link->replay_settings.replay_feature_enabled;
6d31602a9f57a7 Aurabindo Pillai 2025-04-16  616  			bool psr_en = acrtc->dm_irq_params.stream->link->psr_settings.psr_feature_enabled;
6d31602a9f57a7 Aurabindo Pillai 2025-04-16  617  			bool fs_active_var_en = acrtc->dm_irq_params.freesync_config.state
6d31602a9f57a7 Aurabindo Pillai 2025-04-16  618  				== VRR_STATE_ACTIVE_VARIABLE;
6d31602a9f57a7 Aurabindo Pillai 2025-04-16  619  
6c5e25a0255d56 David Tadokoro   2023-03-07  620  			amdgpu_dm_crtc_handle_vblank(acrtc);
09aef2c48e799b Mario Kleiner    2019-04-26  621  
09aef2c48e799b Mario Kleiner    2019-04-26  622  			/* BTR processing for pre-DCE12 ASICs */
585d450c76d1d5 Aurabindo Pillai 2020-08-12 @623  			if (acrtc->dm_irq_params.stream &&
09aef2c48e799b Mario Kleiner    2019-04-26  624  			    adev->family < AMDGPU_FAMILY_AI) {
4a580877bdcb83 Luben Tuikov     2020-08-24  625  				spin_lock_irqsave(&adev_to_drm(adev)->event_lock, flags);
09aef2c48e799b Mario Kleiner    2019-04-26  626  				mod_freesync_handle_v_update(
09aef2c48e799b Mario Kleiner    2019-04-26  627  				    adev->dm.freesync_module,
585d450c76d1d5 Aurabindo Pillai 2020-08-12  628  				    acrtc->dm_irq_params.stream,
585d450c76d1d5 Aurabindo Pillai 2020-08-12  629  				    &acrtc->dm_irq_params.vrr_params);
09aef2c48e799b Mario Kleiner    2019-04-26  630  
6d31602a9f57a7 Aurabindo Pillai 2025-04-16  631  				if (fs_active_var_en || (!fs_active_var_en && !replay_en && !psr_en)) {
c210b757b40095 Aurabindo Pillai 2025-07-21  632  					schedule_dc_vmin_vmax(adev,
585d450c76d1d5 Aurabindo Pillai 2020-08-12  633  						acrtc->dm_irq_params.stream,
585d450c76d1d5 Aurabindo Pillai 2020-08-12  634  						&acrtc->dm_irq_params.vrr_params.adjust);
6d31602a9f57a7 Aurabindo Pillai 2025-04-16  635  				}
4a580877bdcb83 Luben Tuikov     2020-08-24  636  				spin_unlock_irqrestore(&adev_to_drm(adev)->event_lock, flags);
09aef2c48e799b Mario Kleiner    2019-04-26  637  			}
09aef2c48e799b Mario Kleiner    2019-04-26  638  		}
d2574c33bb7195 Mario Kleiner    2019-03-29  639  	}
d2574c33bb7195 Mario Kleiner    2019-03-29  640  }
d2574c33bb7195 Mario Kleiner    2019-03-29  641  

:::::: The code at line 623 was first introduced by commit
:::::: 585d450c76d1d5807a50cb6c22487ae5aed0906b drm/amd/display: Refactor to prevent crtc state access in DM IRQ handler

:::::: TO: Aurabindo Pillai <aurabindo.pillai@amd.com>
:::::: CC: Alex Deucher <alexander.deucher@amd.com>

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2025-08-06  1:32 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-06  1:32 [linux-next:master 13146/13293] drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:623 dm_vupdate_high_irq() warn: variable dereferenced before check 'acrtc->dm_irq_params.stream' (see line 615) kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.