All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Igor Paunovic" <royalnet026@gmail.com>
Cc: intel-xe@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
	intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH v2 3/3] drm/rockchip: dw_dp: Attach "max bpc" connector property
Date: Wed, 09 Sep 2026 17:50:19 +0000	[thread overview]
Message-ID: <20260909175020.519561F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260909173542.14030-4-royalnet026@gmail.com>

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

New issues:
- [Medium] Unconditional connector state allocation causes a memory leak if an HDMI bridge is present in the chain.

Pre-existing issues:
- [High] `devm_` allocations tied to the component device in `dw_dp_bind` cause resource leaks and permanent driver failure if `bind` fails.
--

commit 47f0f730df97f46871d26a1858e6f2594ea7c383
Author: Igor Paunovic <royalnet026@gmail.com>

drm/rockchip: dw_dp: Attach "max bpc" connector property

This commit attaches the "max bpc" property to the dw-dp bridge connector
with a range of 6 to 10. It also explicitly creates the connector state
before drm_mode_config_reset() runs, allowing the property to be attached
successfully during driver initialization.

> diff --git a/drivers/gpu/drm/rockchip/dw_dp-rockchip.c b/drivers/gpu/drm/rockchip/dw_dp-rockchip.c
> index b23efb153c9e6..8ff27353b1417 100644
> --- a/drivers/gpu/drm/rockchip/dw_dp-rockchip.c
> +++ b/drivers/gpu/drm/rockchip/dw_dp-rockchip.c
[ ... ]
> @@ -112,6 +112,32 @@ static int dw_dp_rockchip_bind(struct device *dev, struct device *master, void *
>  				     "Failed to init bridge connector\n");
>  	}
>  
> +	/*
> +	 * The components are bound before drm_mode_config_reset() runs, so
> +	 * the connector has no state yet, but
> +	 * drm_connector_attach_max_bpc_property() requires one. Create the
> +	 * connector state first, like drmm_connector_hdmi_init() does.
> +	 */
> +	if (connector->funcs->atomic_create_state) {
> +		struct drm_connector_state *state;
> +
> +		state = connector->funcs->atomic_create_state(connector);
> +		if (IS_ERR(state)) {
> +			dw_dp_unbind(dp->base);
> +			return PTR_ERR(state);
> +		}
> +
> +		connector->state = state;

[Severity: Medium]
Does this unconditionally overwrite connector->state?

If the display pipeline contains an HDMI bridge (e.g., a DP-to-HDMI chip),
drm_bridge_connector_init() internally calls drmm_connector_hdmi_init(),
which allocates and assigns connector->state. Overwriting it here seems to
leak the previously allocated drm_connector_state.

> +	} else if (connector->funcs->reset) {
> +		connector->funcs->reset(connector);
> +	}
> +
> +	ret = drm_connector_attach_max_bpc_property(connector, 6, 10);
> +	if (ret) {
> +		dw_dp_unbind(dp->base);
> +		return ret;

[Severity: High]
This isn't a regression introduced by this patch, but if this newly added
error path is taken, does it permanently break the driver on deferred probe?

The component bind callback invokes dw_dp_bind() earlier in this function,
which performs devm_ allocations tied to the component device (dev) rather
than the master device. For example:

drivers/gpu/drm/bridge/synopsys/dw-dp.c:dw_dp_bind() {
    ...
    ret = devm_request_threaded_irq(dev, dp->irq, NULL, dw_dp_irq,
                                    IRQF_ONESHOT, dev_name(dev), dp);
    ...
}

Because the component device remains probed even if the bind callback fails,
these devm_ resources are not freed when this error path returns. On a
subsequent bind retry, dw_dp_bind() executes again. Since
devm_request_threaded_irq() does not use IRQF_SHARED, it will return
-EBUSY, permanently failing.

> +	}
> +
>  	return 0;
>  }

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260909163206.36409-1-royalnet026@gmail.com?part=3

  reply	other threads:[~2026-09-09 17:50 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-09 16:31 [PATCH v2 0/3] drm/dp: shared HDR metadata SDP helper, and max bpc for dw-dp Igor Paunovic
2026-09-09 16:31 ` Igor Paunovic
2026-09-09 16:37 ` Igor Paunovic
2026-09-09 16:37   ` Igor Paunovic
2026-09-09 17:35 ` Igor Paunovic
2026-09-09 17:35   ` Igor Paunovic
2026-09-09 17:35 ` [PATCH v2 1/3] drm/dp: Add drm_dp_hdr_metadata_infoframe_sdp_pack() Igor Paunovic
2026-09-09 17:35   ` Igor Paunovic
2026-09-09 17:35 ` [PATCH v2 2/3] drm/display: bridge-connector: Preserve max bpc across connector reset Igor Paunovic
2026-09-09 17:35   ` Igor Paunovic
2026-09-09 17:35 ` [PATCH v2 3/3] drm/rockchip: dw_dp: Attach "max bpc" connector property Igor Paunovic
2026-09-09 17:35   ` Igor Paunovic
2026-09-09 17:50   ` sashiko-bot [this message]
2026-09-09 19:40   ` Igor Paunovic
2026-09-09 19:40     ` Igor Paunovic
2026-09-10  7:16   ` Chaoyi Chen
2026-09-10  7:16     ` Chaoyi Chen
2026-09-10  7:51     ` Igor Paunovic
2026-09-10  7:51       ` Igor Paunovic
2026-09-10  8:16       ` Chaoyi Chen
2026-09-10  8:16         ` Chaoyi Chen
2026-09-10 12:04         ` Igor Paunovic
2026-09-10 12:04           ` Igor Paunovic
2026-09-10 14:25 ` ✗ LGCI.VerificationFailed: failure for drm/dp: shared HDR metadata SDP helper, and max bpc for dw-dp Patchwork
2026-09-10 15:11 ` Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260909175020.519561F000FF@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=royalnet026@gmail.com \
    --cc=sashiko-reviews@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.