Thank you for your contribution! Sashiko AI review found 1 potential issue(s) 
to consider:

Pre-existing issues:
- [High] NULL pointer dereference when `clk_set_rate()` fails in 
`sti_dvo_set_mode()`.
--

--- Patch [34]: [PATCH v2 34/37] drm/sti: dvo: Switch to atomic bridge 
callbacks ---
commit 377cffc6cdd80910f39bda909df8ad2af0ea4cf2
Author: Maxime Ripard <[email protected]>

drm/sti: dvo: Switch to atomic bridge callbacks

This commit switches the sti dvo bridge from using legacy non-atomic bridge
callbacks to their atomic counterparts. It also adds atomic state handlers
as part of the effort to remove legacy support from the DRM bridge core.

> diff --git a/drivers/gpu/drm/sti/sti_dvo.c b/drivers/gpu/drm/sti/sti_dvo.c
> index 7484d3c3f4ed5..b48099468eb97 100644
> --- a/drivers/gpu/drm/sti/sti_dvo.c
> +++ b/drivers/gpu/drm/sti/sti_dvo.c

[ ... ]

> @@ -232,7 +233,8 @@ static void sti_dvo_disable(struct drm_bridge *bridge)
>       dvo->enabled = false;
>  }
>  
> -static void sti_dvo_pre_enable(struct drm_bridge *bridge)
> +static void sti_dvo_pre_enable(struct drm_bridge *bridge,
> +                            struct drm_atomic_commit *commit)
>  {
>       struct sti_dvo *dvo = bridge->driver_private;
>       struct dvo_config *config = dvo->config;

[Severity: High]
This isn't a bug introduced by this patch, but can this lead to a NULL
pointer dereference?

If clk_set_rate() fails during the modeset in sti_dvo_set_mode(), it returns
early and skips setting dvo->config:

drivers/gpu/drm/sti/sti_dvo.c:sti_dvo_set_mode() {
    ...
        ret = clk_set_rate(dvo->clk_pix, rate);
        if (ret < 0) {
                DRM_ERROR("Cannot set rate (%dHz) for dvo_pix clk\n", rate);
                return;
        }
    ...
        dvo->config = &rgb_24bit_de_cfg;
}

When sti_dvo_pre_enable() is called later on the atomic commit path, config
is assigned dvo->config (which would be NULL if it was the first modeset),
and then it gets dereferenced unconditionally shortly after:

drivers/gpu/drm/sti/sti_dvo.c:sti_dvo_pre_enable() {
    ...
        if (config->awg_fwgen_fct) {
    ...
}

[ ... ]

-- 
Sashiko AI review ยท 
https://sashiko.dev/#/patchset/[email protected]?part=34

Reply via email to