Thank you for your contribution! Sashiko AI review found 1 potential issue(s) 
to consider:
- [Medium] drm/stm: missing ltdc_unload() on initial state failure in drv_load()
--

commit 98591c9473b768ebdd97e226182eb80066137927
Author: Maxime Ripard <[email protected]>

drm/stm: Switch to drm_mode_config_create_initial_state

This commit replaces the probe-time drm_mode_config_reset() call in drv_load()
with drm_mode_config_create_initial_state() and propagates any error returned
during initial KMS state creation.

> diff --git a/drivers/gpu/drm/stm/drv.c b/drivers/gpu/drm/stm/drv.c
> index 0967b9b3451db..60343ffe02f7d 100644
> --- a/drivers/gpu/drm/stm/drv.c
> +++ b/drivers/gpu/drm/stm/drv.c
> @@ -104,7 +104,9 @@ static int drv_load(struct drm_device *ddev)
>       if (ret)
>               return ret;
>  
> -     drm_mode_config_reset(ddev);
> +     ret = drm_mode_config_create_initial_state(ddev);
> +     if (ret)
> +             return ret;

[Severity: Medium]
If drm_mode_config_create_initial_state() fails in drv_load() after
ltdc_load() has already succeeded, does this leave runtime PM enabled on
ddev->dev without calling ltdc_unload()?

In drivers/gpu/drm/stm/ltdc.c, ltdc_load() enables runtime PM via an
unmanaged call before returning:

ltdc_load()
        pm_runtime_enable(ddev->dev);
        return 0;

When drv_load() returns an error, stm_drm_platform_probe() in
drivers/gpu/drm/stm/drv.c jumps to err_put, bypassing drv_unload() and
ltdc_unload():

stm_drm_platform_probe()
        ret = drv_load(ddev);
        if (ret)
                goto err_put;

        ret = drm_dev_register(ddev, 0);
        if (ret)
                goto err_unload;
        ...
err_unload:
        drv_unload(ddev);
err_put:
        drm_dev_put(ddev);

Because platform_set_drvdata() is not reached in drv_load() on this failure
path and runtime PM remains enabled while ddev is freed, a runtime PM callback
running before unbind completes could also see a NULL ddev from
dev_get_drvdata(dev) in drv_runtime_suspend() or drv_runtime_resume().

Should drv_load() call ltdc_unload(ddev) on error if
drm_mode_config_create_initial_state() fails?

-- 
Sashiko AI review · 
https://sashiko.dev/#/patchset/[email protected]?part=46

Reply via email to