[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <4486560b-05e5-6c03-0a8e-4f193141a5c8@samsung.com>
Date: Fri, 17 Jan 2020 11:03:03 +0100
From: Andrzej Hajda <a.hajda@...sung.com>
To: Tobias Schramm <t.schramm@...jaro.org>,
Neil Armstrong <narmstrong@...libre.com>,
Laurent Pinchart <Laurent.pinchart@...asonboard.com>,
Jonas Karlman <jonas@...boo.se>,
Jernej Skrabec <jernej.skrabec@...l.net>
Cc: David Airlie <airlied@...ux.ie>, Daniel Vetter <daniel@...ll.ch>,
dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/1] drm/bridge: anx78xx: fix integer type used for
storing dp link rate
On 09.01.2020 09:48, Tobias Schramm wrote:
> commit ff1e8fb68ea0 ("drm/bridge: analogix-anx78xx: Avoid drm_dp_link helpers")
> changed the link training logic to remove use of drm_dp_link helpers. However
> the new logic stores the maximum link rate in a u8, overflowing it.
> This commit changes the logic to store the max link rate in a unsigned int
> instead.
>
> Signed-off-by: Tobias Schramm <t.schramm@...jaro.org>
> ---
> drivers/gpu/drm/bridge/analogix-anx78xx.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/bridge/analogix-anx78xx.c b/drivers/gpu/drm/bridge/analogix-anx78xx.c
> index 274989f96a91..0f38b8c40dff 100644
> --- a/drivers/gpu/drm/bridge/analogix-anx78xx.c
> +++ b/drivers/gpu/drm/bridge/analogix-anx78xx.c
> @@ -748,6 +748,7 @@ static int anx78xx_init_pdata(struct anx78xx *anx78xx)
> static int anx78xx_dp_link_training(struct anx78xx *anx78xx)
> {
> u8 dp_bw, dpcd[2];
> + unsigned int max_link_rate;
> int err;
>
> err = regmap_write(anx78xx->map[I2C_IDX_RX_P0], SP_HDMI_MUTE_CTRL_REG,
> @@ -866,8 +867,8 @@ static int anx78xx_dp_link_training(struct anx78xx *anx78xx)
> if (err)
> return err;
>
> - dpcd[0] = drm_dp_max_link_rate(anx78xx->dpcd);
> - dpcd[0] = drm_dp_link_rate_to_bw_code(dpcd[0]);
> + max_link_rate = drm_dp_max_link_rate(anx78xx->dpcd);
> + dpcd[0] = drm_dp_link_rate_to_bw_code(max_link_rate);
The code converts bw_code to rate, then reverse, maybe it should be
simplified:
dpcd[0] = anx78xx->dpcd[DP_MAX_LINK_RATE];
Regards
Andrzej
> err = regmap_write(anx78xx->map[I2C_IDX_TX_P0],
> SP_DP_MAIN_LINK_BW_SET_REG, dpcd[0]);
> if (err)
Powered by blists - more mailing lists