Hi,

On Fri, Jul 17, 2026 at 7:32 AM Johan Hovold <[email protected]> wrote:
>
> Make sure to drop the i2c adapter reference on probe failure (e.g.
> probe deferral) and on driver unbind also if a devicetree redundantly
> uses the 'ddc-i2c-bus' property to point to the aux ddc bus.
>
> Fixes: cc5a3fc041f0 ("drm/panel: panel-simple: Stash DP AUX bus; allow using 
> it for DDC")
> Cc: [email protected]      # 5.15
> Reported-by: Douglas Anderson <[email protected]>
> Link: 
> https://lore.kernel.org/r/CAD=FV=vzphzhu+pet2m3l+pqc7mopfzc-f5p0ounl79wnzp...@mail.gmail.com
> Signed-off-by: Johan Hovold <[email protected]>
> ---
>  drivers/gpu/drm/panel/panel-edp.c | 19 +++++++++++++------
>  1 file changed, 13 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/panel/panel-edp.c 
> b/drivers/gpu/drm/panel/panel-edp.c
> index aa27d6cd932e..ac815729aa83 100644
> --- a/drivers/gpu/drm/panel/panel-edp.c
> +++ b/drivers/gpu/drm/panel/panel-edp.c
> @@ -831,6 +831,13 @@ static int generic_edp_panel_probe(struct device *dev, 
> struct panel_edp *panel)
>         return 0;
>  }
>
> +static void panel_edp_put_adapter(void *_adap)
> +{
> +       struct i2c_adapter *adap = _adap;
> +
> +       put_device(&adap->dev);
> +}
> +
>  static int panel_edp_probe(struct device *dev, const struct panel_desc *desc,
>                            struct drm_dp_aux *aux)
>  {
> @@ -878,6 +885,11 @@ static int panel_edp_probe(struct device *dev, const 
> struct panel_desc *desc,
>
>                 if (!panel->ddc)
>                         return -EPROBE_DEFER;
> +
> +               err = devm_add_action_or_reset(dev, panel_edp_put_adapter,
> +                                              panel->ddc);
> +               if (err)
> +                       return err;

Yeah, devm makes this so much nicer. Thanks for fixing!

Reviewed-by: Douglas Anderson <[email protected]>

I'll plan to apply this, probably to drm-misc-next next week. Unless
someone objects, I won't land it -fixes because it's such a corner
case.

-Doug

Reply via email to