Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Medium] drm/hdlcd: invalid drm_atomic_helper_shutdown() on hdlcd_probe() error path --
commit 05385ee4b911593ec2d698a13a97eb831b545f6c Author: Maxime Ripard <[email protected]> drm/hdlcd: Switch to drm_mode_config_create_initial_state This commit replaces the probe-time call to drm_mode_config_reset() in hdlcd_probe() with drm_mode_config_create_initial_state() and jumps to err_vblank on error. > diff --git a/drivers/gpu/drm/arm/hdlcd_drv.c b/drivers/gpu/drm/arm/hdlcd_drv.c > index 340b1bb38bf92..58ee8ad1d2ea6 100644 > --- a/drivers/gpu/drm/arm/hdlcd_drv.c > +++ b/drivers/gpu/drm/arm/hdlcd_drv.c > @@ -318,7 +318,9 @@ static int hdlcd_probe(struct platform_device *pdev) > aperture_remove_all_conflicting_devices(hdlcd_driver.name); > } > > - drm_mode_config_reset(drm); > + ret = drm_mode_config_create_initial_state(drm); > + if (ret) > + goto err_vblank; [Severity: Medium] If drm_mode_config_create_initial_state() fails in hdlcd_probe() in drivers/gpu/drm/arm/hdlcd_drv.c, jumping to err_vblank disables runtime PM and falls through to err_pm_active, which calls drm_atomic_helper_shutdown(): err_vblank: pm_runtime_disable(drm->dev); err_pm_active: drm_atomic_helper_shutdown(drm); In drm_mode_config_create_initial_state(), initial state objects are allocated sequentially for private objects, colorops, planes, CRTCs, and connectors. If state allocation fails before or during drm_mode_config_crtc_create_state(), hdlcd->crtc.state remains NULL. Calling drm_atomic_helper_shutdown() then invokes: drm_atomic_helper_shutdown() drm_atomic_helper_disable_all() drm_atomic_get_crtc_state() drm_atomic_helper_crtc_duplicate_state() where drm_atomic_helper_crtc_duplicate_state() in drivers/gpu/drm/drm_atomic_state_helper.c hits: if (WARN_ON(!crtc->state)) return NULL; Even if crtc->state was allocated and connector state allocation failed, drm_atomic_helper_shutdown() attempts an atomic commit on partially initialized KMS state after pm_runtime_disable() has already disabled runtime PM (and before any modeset was committed, which also affects the existing pm_runtime_set_active() and drm_vblank_init() error paths). Should drm_atomic_helper_shutdown() be avoided on probe error paths where initial KMS state creation has not completed or runtime PM is already disabled? -- Sashiko AI review ยท https://sashiko.dev/#/patchset/[email protected]?part=5
