diff mbox series

drm/bridge: ti-sn65dsi83: Handle dsi_lanes == 0 as invalid

Message ID 20220518233844.248504-1-marex@denx.de (mailing list archive)
State New, archived
Headers show
Series drm/bridge: ti-sn65dsi83: Handle dsi_lanes == 0 as invalid | expand

Commit Message

Marek Vasut May 18, 2022, 11:38 p.m. UTC
Handle empty data-lanes = < >; property, which translates to
dsi_lanes = 0 as invalid.

Fixes: ceb515ba29ba6 ("drm/bridge: ti-sn65dsi83: Add TI SN65DSI83 and SN65DSI84 driver")
Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Jonas Karlman <jonas@kwiboo.se>
Cc: Laurent Pinchart <Laurent.pinchart@ideasonboard.com>
Cc: Lucas Stach <l.stach@pengutronix.de>
Cc: Marek Vasut <marex@denx.de>
Cc: Maxime Ripard <maxime@cerno.tech>
Cc: Neil Armstrong <narmstrong@baylibre.com>
Cc: Robert Foss <robert.foss@linaro.org>
Cc: Sam Ravnborg <sam@ravnborg.org>
---
 drivers/gpu/drm/bridge/ti-sn65dsi83.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Andrzej Hajda May 19, 2022, 7:43 a.m. UTC | #1
On 19.05.2022 01:38, Marek Vasut wrote:
> Handle empty data-lanes = < >; property, which translates to
> dsi_lanes = 0 as invalid.
> 
> Fixes: ceb515ba29ba6 ("drm/bridge: ti-sn65dsi83: Add TI SN65DSI83 and SN65DSI84 driver")
> Signed-off-by: Marek Vasut <marex@denx.de>
> Cc: Jonas Karlman <jonas@kwiboo.se>
> Cc: Laurent Pinchart <Laurent.pinchart@ideasonboard.com>
> Cc: Lucas Stach <l.stach@pengutronix.de>
> Cc: Marek Vasut <marex@denx.de>
> Cc: Maxime Ripard <maxime@cerno.tech>
> Cc: Neil Armstrong <narmstrong@baylibre.com>
> Cc: Robert Foss <robert.foss@linaro.org>
> Cc: Sam Ravnborg <sam@ravnborg.org>

I wonder if you could not make common helper to get number of lanes with 
checks included, quite trivial, but maybe worth to standardize it.

Reviewed-by: Andrzej Hajda <andrzej.hajda@intel.com>

Regards
Andrzej
> ---
>   drivers/gpu/drm/bridge/ti-sn65dsi83.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/bridge/ti-sn65dsi83.c b/drivers/gpu/drm/bridge/ti-sn65dsi83.c
> index d64d4385188dd..dc65f424e7f3c 100644
> --- a/drivers/gpu/drm/bridge/ti-sn65dsi83.c
> +++ b/drivers/gpu/drm/bridge/ti-sn65dsi83.c
> @@ -585,7 +585,7 @@ static int sn65dsi83_parse_dt(struct sn65dsi83 *ctx, enum sn65dsi83_model model)
>   	ctx->host_node = of_graph_get_remote_port_parent(endpoint);
>   	of_node_put(endpoint);
>   
> -	if (ctx->dsi_lanes < 0 || ctx->dsi_lanes > 4) {
> +	if (ctx->dsi_lanes <= 0 || ctx->dsi_lanes > 4) {
>   		ret = -EINVAL;
>   		goto err_put_node;
>   	}
Lucas Stach May 19, 2022, 7:57 a.m. UTC | #2
Am Donnerstag, dem 19.05.2022 um 01:38 +0200 schrieb Marek Vasut:
> Handle empty data-lanes = < >; property, which translates to
> dsi_lanes = 0 as invalid.
> 
> Fixes: ceb515ba29ba6 ("drm/bridge: ti-sn65dsi83: Add TI SN65DSI83 and SN65DSI84 driver")
> Signed-off-by: Marek Vasut <marex@denx.de>
> Cc: Jonas Karlman <jonas@kwiboo.se>
> Cc: Laurent Pinchart <Laurent.pinchart@ideasonboard.com>
> Cc: Lucas Stach <l.stach@pengutronix.de>
> Cc: Marek Vasut <marex@denx.de>
> Cc: Maxime Ripard <maxime@cerno.tech>
> Cc: Neil Armstrong <narmstrong@baylibre.com>
> Cc: Robert Foss <robert.foss@linaro.org>
> Cc: Sam Ravnborg <sam@ravnborg.org>

Reviewed-by: Lucas Stach <l.stach@pengutronix.de>

> ---
>  drivers/gpu/drm/bridge/ti-sn65dsi83.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/bridge/ti-sn65dsi83.c b/drivers/gpu/drm/bridge/ti-sn65dsi83.c
> index d64d4385188dd..dc65f424e7f3c 100644
> --- a/drivers/gpu/drm/bridge/ti-sn65dsi83.c
> +++ b/drivers/gpu/drm/bridge/ti-sn65dsi83.c
> @@ -585,7 +585,7 @@ static int sn65dsi83_parse_dt(struct sn65dsi83 *ctx, enum sn65dsi83_model model)
>  	ctx->host_node = of_graph_get_remote_port_parent(endpoint);
>  	of_node_put(endpoint);
>  
> -	if (ctx->dsi_lanes < 0 || ctx->dsi_lanes > 4) {
> +	if (ctx->dsi_lanes <= 0 || ctx->dsi_lanes > 4) {
>  		ret = -EINVAL;
>  		goto err_put_node;
>  	}
Robert Foss May 23, 2022, 9:40 a.m. UTC | #3
On Thu, 19 May 2022 at 09:57, Lucas Stach <l.stach@pengutronix.de> wrote:
>
> Am Donnerstag, dem 19.05.2022 um 01:38 +0200 schrieb Marek Vasut:
> > Handle empty data-lanes = < >; property, which translates to
> > dsi_lanes = 0 as invalid.
> >
> > Fixes: ceb515ba29ba6 ("drm/bridge: ti-sn65dsi83: Add TI SN65DSI83 and SN65DSI84 driver")
> > Signed-off-by: Marek Vasut <marex@denx.de>
> > Cc: Jonas Karlman <jonas@kwiboo.se>
> > Cc: Laurent Pinchart <Laurent.pinchart@ideasonboard.com>
> > Cc: Lucas Stach <l.stach@pengutronix.de>
> > Cc: Marek Vasut <marex@denx.de>
> > Cc: Maxime Ripard <maxime@cerno.tech>
> > Cc: Neil Armstrong <narmstrong@baylibre.com>
> > Cc: Robert Foss <robert.foss@linaro.org>
> > Cc: Sam Ravnborg <sam@ravnborg.org>
>
> Reviewed-by: Lucas Stach <l.stach@pengutronix.de>
>
> > ---
> >  drivers/gpu/drm/bridge/ti-sn65dsi83.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpu/drm/bridge/ti-sn65dsi83.c b/drivers/gpu/drm/bridge/ti-sn65dsi83.c
> > index d64d4385188dd..dc65f424e7f3c 100644
> > --- a/drivers/gpu/drm/bridge/ti-sn65dsi83.c
> > +++ b/drivers/gpu/drm/bridge/ti-sn65dsi83.c
> > @@ -585,7 +585,7 @@ static int sn65dsi83_parse_dt(struct sn65dsi83 *ctx, enum sn65dsi83_model model)
> >       ctx->host_node = of_graph_get_remote_port_parent(endpoint);
> >       of_node_put(endpoint);
> >
> > -     if (ctx->dsi_lanes < 0 || ctx->dsi_lanes > 4) {
> > +     if (ctx->dsi_lanes <= 0 || ctx->dsi_lanes > 4) {
> >               ret = -EINVAL;
> >               goto err_put_node;
> >       }
>
>

Applied to drm-misc-next.
Marek Vasut May 23, 2022, 9:58 a.m. UTC | #4
On 5/23/22 11:40, Robert Foss wrote:
> On Thu, 19 May 2022 at 09:57, Lucas Stach <l.stach@pengutronix.de> wrote:
>>
>> Am Donnerstag, dem 19.05.2022 um 01:38 +0200 schrieb Marek Vasut:
>>> Handle empty data-lanes = < >; property, which translates to
>>> dsi_lanes = 0 as invalid.

[...]

>>> diff --git a/drivers/gpu/drm/bridge/ti-sn65dsi83.c b/drivers/gpu/drm/bridge/ti-sn65dsi83.c
>>> index d64d4385188dd..dc65f424e7f3c 100644
>>> --- a/drivers/gpu/drm/bridge/ti-sn65dsi83.c
>>> +++ b/drivers/gpu/drm/bridge/ti-sn65dsi83.c
>>> @@ -585,7 +585,7 @@ static int sn65dsi83_parse_dt(struct sn65dsi83 *ctx, enum sn65dsi83_model model)
>>>        ctx->host_node = of_graph_get_remote_port_parent(endpoint);
>>>        of_node_put(endpoint);
>>>
>>> -     if (ctx->dsi_lanes < 0 || ctx->dsi_lanes > 4) {
>>> +     if (ctx->dsi_lanes <= 0 || ctx->dsi_lanes > 4) {
>>>                ret = -EINVAL;
>>>                goto err_put_node;
>>>        }
>>
>>
> 
> Applied to drm-misc-next.

This was already applied to drm-misc-next-fixes , since this is a fix 
for something that was already in release . The conflict will resolve 
itself easily though ?
Robert Foss May 23, 2022, 10:23 a.m. UTC | #5
On Mon, 23 May 2022 at 11:58, Marek Vasut <marex@denx.de> wrote:
>
> On 5/23/22 11:40, Robert Foss wrote:
> > On Thu, 19 May 2022 at 09:57, Lucas Stach <l.stach@pengutronix.de> wrote:
> >>
> >> Am Donnerstag, dem 19.05.2022 um 01:38 +0200 schrieb Marek Vasut:
> >>> Handle empty data-lanes = < >; property, which translates to
> >>> dsi_lanes = 0 as invalid.
>
> [...]
>
> >>> diff --git a/drivers/gpu/drm/bridge/ti-sn65dsi83.c b/drivers/gpu/drm/bridge/ti-sn65dsi83.c
> >>> index d64d4385188dd..dc65f424e7f3c 100644
> >>> --- a/drivers/gpu/drm/bridge/ti-sn65dsi83.c
> >>> +++ b/drivers/gpu/drm/bridge/ti-sn65dsi83.c
> >>> @@ -585,7 +585,7 @@ static int sn65dsi83_parse_dt(struct sn65dsi83 *ctx, enum sn65dsi83_model model)
> >>>        ctx->host_node = of_graph_get_remote_port_parent(endpoint);
> >>>        of_node_put(endpoint);
> >>>
> >>> -     if (ctx->dsi_lanes < 0 || ctx->dsi_lanes > 4) {
> >>> +     if (ctx->dsi_lanes <= 0 || ctx->dsi_lanes > 4) {
> >>>                ret = -EINVAL;
> >>>                goto err_put_node;
> >>>        }
> >>
> >>
> >
> > Applied to drm-misc-next.
>
> This was already applied to drm-misc-next-fixes , since this is a fix
> for something that was already in release . The conflict will resolve
> itself easily though ?

Ah, I didn't realize. I'm not sure if it will resolve itself or not.
But I think either it is reverted in drm-misc-next now, or we wait for
an issue to crop up. I think either way is acceptable, but waiting
maybe causes less churn. So unless someone has another preference,
let's wait and see if a conflict arises.
Marek Vasut May 23, 2022, 10:54 a.m. UTC | #6
On 5/23/22 12:23, Robert Foss wrote:
> On Mon, 23 May 2022 at 11:58, Marek Vasut <marex@denx.de> wrote:
>>
>> On 5/23/22 11:40, Robert Foss wrote:
>>> On Thu, 19 May 2022 at 09:57, Lucas Stach <l.stach@pengutronix.de> wrote:
>>>>
>>>> Am Donnerstag, dem 19.05.2022 um 01:38 +0200 schrieb Marek Vasut:
>>>>> Handle empty data-lanes = < >; property, which translates to
>>>>> dsi_lanes = 0 as invalid.
>>
>> [...]
>>
>>>>> diff --git a/drivers/gpu/drm/bridge/ti-sn65dsi83.c b/drivers/gpu/drm/bridge/ti-sn65dsi83.c
>>>>> index d64d4385188dd..dc65f424e7f3c 100644
>>>>> --- a/drivers/gpu/drm/bridge/ti-sn65dsi83.c
>>>>> +++ b/drivers/gpu/drm/bridge/ti-sn65dsi83.c
>>>>> @@ -585,7 +585,7 @@ static int sn65dsi83_parse_dt(struct sn65dsi83 *ctx, enum sn65dsi83_model model)
>>>>>         ctx->host_node = of_graph_get_remote_port_parent(endpoint);
>>>>>         of_node_put(endpoint);
>>>>>
>>>>> -     if (ctx->dsi_lanes < 0 || ctx->dsi_lanes > 4) {
>>>>> +     if (ctx->dsi_lanes <= 0 || ctx->dsi_lanes > 4) {
>>>>>                 ret = -EINVAL;
>>>>>                 goto err_put_node;
>>>>>         }
>>>>
>>>>
>>>
>>> Applied to drm-misc-next.
>>
>> This was already applied to drm-misc-next-fixes , since this is a fix
>> for something that was already in release . The conflict will resolve
>> itself easily though ?
> 
> Ah, I didn't realize. I'm not sure if it will resolve itself or not.
> But I think either it is reverted in drm-misc-next now, or we wait for
> an issue to crop up. I think either way is acceptable, but waiting
> maybe causes less churn. So unless someone has another preference,
> let's wait and see if a conflict arises.

I agree, we wait.
diff mbox series

Patch

diff --git a/drivers/gpu/drm/bridge/ti-sn65dsi83.c b/drivers/gpu/drm/bridge/ti-sn65dsi83.c
index d64d4385188dd..dc65f424e7f3c 100644
--- a/drivers/gpu/drm/bridge/ti-sn65dsi83.c
+++ b/drivers/gpu/drm/bridge/ti-sn65dsi83.c
@@ -585,7 +585,7 @@  static int sn65dsi83_parse_dt(struct sn65dsi83 *ctx, enum sn65dsi83_model model)
 	ctx->host_node = of_graph_get_remote_port_parent(endpoint);
 	of_node_put(endpoint);
 
-	if (ctx->dsi_lanes < 0 || ctx->dsi_lanes > 4) {
+	if (ctx->dsi_lanes <= 0 || ctx->dsi_lanes > 4) {
 		ret = -EINVAL;
 		goto err_put_node;
 	}