drivers/gpu/drm/gud/gud_pipe.c:616 gud_plane_atomic_update() error: we previously assumed 'crtc' could be null (see line 597)
kernel test robot
build botBCC: [email protected]
CC: [email protected]
TO: Shenghao Yang <[email protected]>
CC: Ruben Wauters <[email protected]>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master head: b775e489bec70895b7ef6b66927886bbac79598f commit: dc2d5ddb193e363187bae2ad358245642d2721fb [5767/6121] drm/gud: fix NULL fb and crtc dereferences on USB disconnect
:::::: branch date: 8 hours ago
:::::: commit date: 23 hours ago
config: x86_64-randconfig-161-20260114 (https://download.01.org/0day-ci/archive/20260114/[email protected]/config)
compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)
rustc: rustc 1.88.0 (6b00bc388 2025-06-23)
smatch version: v0.5.0-8985-g2614ff1a
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 <[email protected]> | Reported-by: Dan Carpenter <[email protected]> | Closes: https://lore.kernel.org/r/[email protected]/
smatch warnings:drivers/gpu/drm/gud/gud_pipe.c:616 gud_plane_atomic_update() error: we previously assumed 'crtc' could be null (see line 597)
vim +/crtc +616 drivers/gpu/drm/gud/gud_pipe.c
40e1a70b4aedf2 Noralf Trønnes 2021-03-13 582
73cfd166e04576 Ruben Wauters 2025-08-18 583 void gud_plane_atomic_update(struct drm_plane *plane,
73cfd166e04576 Ruben Wauters 2025-08-18 584 struct drm_atomic_state *atomic_state)
40e1a70b4aedf2 Noralf Trønnes 2021-03-13 585 {
73cfd166e04576 Ruben Wauters 2025-08-18 586 struct drm_device *drm = plane->dev;
40e1a70b4aedf2 Noralf Trønnes 2021-03-13 587 struct gud_device *gdrm = to_gud_device(drm);
73cfd166e04576 Ruben Wauters 2025-08-18 588 struct drm_plane_state *old_state = drm_atomic_get_old_plane_state(atomic_state, plane);
73cfd166e04576 Ruben Wauters 2025-08-18 589 struct drm_plane_state *new_state = drm_atomic_get_new_plane_state(atomic_state, plane);
73cfd166e04576 Ruben Wauters 2025-08-18 590 struct drm_shadow_plane_state *shadow_plane_state = to_drm_shadow_plane_state(new_state);
73cfd166e04576 Ruben Wauters 2025-08-18 591 struct drm_framebuffer *fb = new_state->fb;
73cfd166e04576 Ruben Wauters 2025-08-18 592 struct drm_crtc *crtc = new_state->crtc;40e1a70b4aedf2 Noralf Trønnes 2021-03-13 593 struct drm_rect damage;73cfd166e04576 Ruben Wauters 2025-08-18 594 struct drm_atomic_helper_damage_iter iter;c17d048609bf09 Noralf Trønnes 2022-11-30 595 int ret, idx;40e1a70b4aedf2 Noralf Trønnes 2021-03-13 596dc2d5ddb193e36 Shenghao Yang 2025-12-31 @597 if (!crtc || crtc->state->mode_changed || !crtc->state->enable) {
40e1a70b4aedf2 Noralf Trønnes 2021-03-13 598 cancel_work_sync(&gdrm->work);
40e1a70b4aedf2 Noralf Trønnes 2021-03-13 599 mutex_lock(&gdrm->damage_lock);
40e1a70b4aedf2 Noralf Trønnes 2021-03-13 600 if (gdrm->fb) {
40e1a70b4aedf2 Noralf Trønnes 2021-03-13 601 drm_framebuffer_put(gdrm->fb);
40e1a70b4aedf2 Noralf Trønnes 2021-03-13 602 gdrm->fb = NULL;
40e1a70b4aedf2 Noralf Trønnes 2021-03-13 603 }
40e1a70b4aedf2 Noralf Trønnes 2021-03-13 604 gud_clear_damage(gdrm);
c17d048609bf09 Noralf Trønnes 2022-11-30 605 vfree(gdrm->shadow_buf);
c17d048609bf09 Noralf Trønnes 2022-11-30 606 gdrm->shadow_buf = NULL;
40e1a70b4aedf2 Noralf Trønnes 2021-03-13 607 mutex_unlock(&gdrm->damage_lock);
40e1a70b4aedf2 Noralf Trønnes 2021-03-13 608 }
40e1a70b4aedf2 Noralf Trønnes 2021-03-13 609
40e1a70b4aedf2 Noralf Trønnes 2021-03-13 610 if (!drm_dev_enter(drm, &idx))
40e1a70b4aedf2 Noralf Trønnes 2021-03-13 611 return;
40e1a70b4aedf2 Noralf Trønnes 2021-03-13 612
40e1a70b4aedf2 Noralf Trønnes 2021-03-13 613 if (!old_state->fb)
40e1a70b4aedf2 Noralf Trønnes 2021-03-13 614 gud_usb_set_u8(gdrm, GUD_REQ_SET_CONTROLLER_ENABLE, 1);
40e1a70b4aedf2 Noralf Trønnes 2021-03-13 615 40e1a70b4aedf2 Noralf Trønnes 2021-03-13 @616 if (fb && (crtc->state->mode_changed || crtc->state->connectors_changed))
:::::: The code at line 616 was first introduced by commit
:::::: 40e1a70b4aedf2859a1829991b48ef0ebe650bf2 drm: Add GUD USB Display driver
:::::: TO: Noralf Trønnes <[email protected]>
:::::: CC: Noralf Trønnes <[email protected]>
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki