Re: [PATCH v4 2/3] drm/bridge: analogix_dp: Add validation for samsung,lane-count property
From: Luca Ceresoli
Date: Mon Jun 01 2026 - 08:09:28 EST
Hello Damon,
On 2026-06-01 10:59:27+08:00, Damon Ding wrote:
> Hi Luca,
>
> On 5/30/2026 9:38 PM, Luca Ceresoli wrote:
>
> > On Sat May 30, 2026 at 3:33 PM CEST, Luca Ceresoli wrote:
> >
> > Meh, messed up with 'b4 review' :-/ Apologies
> >
> > "This sashiko report" [0] was about an enum being signed, so '== 0' could miss
> > negative numbers coming from bogus DT values higher than 1^31.
>
> Ah, I agree. It would be better to add a new inline function to validate
> that the lane count passed from DT is exactly 1, 2, or 4, just as
> Sashiko suggested.
>
> >>
> >
> > And this was about "Additionally, does this check inadvertently allow 3,
> > which is an invalid DisplayPort lane count?"
>
> Yes, the DisplayPort specification only allows lane counts of 1, 2, or
> 4. I did miss the check for the invalid value 3 in the current code.
>
> (BTW: I did not find a common helper function in drm_dp_helper.h to
> validate valid DP lane counts (1, 2, 4). I'm not sure if it would be
> better to add a generic lane count validation function to the DP helper
> library instead, to avoid duplicating the same functionality across
> individual DP drivers. Perhaps other DP experts could provide some
> advice on this.)
A bool function in common code, to be reused by all DP drivers, would be
good.