All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1 0/1] Fixes 30e2ae943c26 "drm/bridge: Introduce LT8912B DSI to HDMI
@ 2021-03-31  9:38 Adrien Grassein
  2021-03-31  9:38 ` [PATCH v1 1/1] drm/bridge: lt8912b: Fix issues found during static analysis Adrien Grassein
  0 siblings, 1 reply; 4+ messages in thread
From: Adrien Grassein @ 2021-03-31  9:38 UTC (permalink / raw)
  Cc: dri-devel, dan.carpenter, Adrien Grassein

Hi,

This patch fixes issues found by a static checker.

Thanks,

Adrien Grassein (1):
  drm/bridge: lt8912b: Fix issues found during static analysis

 drivers/gpu/drm/bridge/lontium-lt8912b.c | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

-- 
2.25.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v1 1/1] drm/bridge: lt8912b: Fix issues found during static analysis
  2021-03-31  9:38 [PATCH v1 0/1] Fixes 30e2ae943c26 "drm/bridge: Introduce LT8912B DSI to HDMI Adrien Grassein
@ 2021-03-31  9:38 ` Adrien Grassein
  2021-03-31 10:29   ` Dan Carpenter
  0 siblings, 1 reply; 4+ messages in thread
From: Adrien Grassein @ 2021-03-31  9:38 UTC (permalink / raw)
  Cc: dri-devel, dan.carpenter, Adrien Grassein

Some issues where found during static analysis of this driver.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Suggested-by: Dan Carpenter  <dan.carpenter@oracle.com>
Signed-off-by: Adrien Grassein <adrien.grassein@gmail.com>
---
 drivers/gpu/drm/bridge/lontium-lt8912b.c | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/bridge/lontium-lt8912b.c b/drivers/gpu/drm/bridge/lontium-lt8912b.c
index 61491615bad0..9a5a19655362 100644
--- a/drivers/gpu/drm/bridge/lontium-lt8912b.c
+++ b/drivers/gpu/drm/bridge/lontium-lt8912b.c
@@ -635,13 +635,15 @@ static int lt8912_parse_dt(struct lt8912 *lt)
 	lt->gp_reset = gp_reset;
 
 	endpoint = of_graph_get_endpoint_by_regs(dev->of_node, 0, -1);
-	if (IS_ERR(endpoint)) {
-		ret = PTR_ERR(endpoint);
-		goto end;
-	}
+	if (!endpoint)
+		return -ENODEV;
 
 	lt->data_lanes = of_property_count_u32_elems(endpoint, "data-lanes");
 	of_node_put(endpoint);
+	if (lt->data_lanes < 0) {
+		dev_err(lt->dev, "%s: Bad data-lanes property\n", __func__);
+		return lt->data_lanes;
+	}
 
 	lt->host_node = of_graph_get_remote_node(dev->of_node, 0, -1);
 	if (!lt->host_node) {
@@ -658,16 +660,18 @@ static int lt8912_parse_dt(struct lt8912 *lt)
 	}
 
 	lt->hdmi_port = of_drm_find_bridge(port_node);
-	if (IS_ERR(lt->hdmi_port)) {
+	if (!lt->hdmi_port) {
 		dev_err(lt->dev, "%s: Failed to get hdmi port\n", __func__);
-		ret = PTR_ERR(lt->hdmi_port);
-		of_node_put(lt->host_node);
-		goto end;
+		ret = -ENODEV;
+		of_node_put(port_node);
+		goto err_free_host_node;
 	}
 
 	if (!of_device_is_compatible(port_node, "hdmi-connector")) {
 		dev_err(lt->dev, "%s: Failed to get hdmi port\n", __func__);
+		of_node_put(port_node);
 		ret = -EINVAL;
+		goto err_free_host_node;
 	}
 
 	of_node_put(port_node);
-- 
2.25.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v1 1/1] drm/bridge: lt8912b: Fix issues found during static analysis
  2021-03-31  9:38 ` [PATCH v1 1/1] drm/bridge: lt8912b: Fix issues found during static analysis Adrien Grassein
@ 2021-03-31 10:29   ` Dan Carpenter
  2021-03-31 10:42     ` Adrien Grassein
  0 siblings, 1 reply; 4+ messages in thread
From: Dan Carpenter @ 2021-03-31 10:29 UTC (permalink / raw)
  To: Adrien Grassein; +Cc: dri-devel

On Wed, Mar 31, 2021 at 11:38:22AM +0200, Adrien Grassein wrote:
> Some issues where found during static analysis of this driver.
> 
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Suggested-by: Dan Carpenter  <dan.carpenter@oracle.com>
> Signed-off-by: Adrien Grassein <adrien.grassein@gmail.com>
> ---
>  drivers/gpu/drm/bridge/lontium-lt8912b.c | 20 ++++++++++++--------
>  1 file changed, 12 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/gpu/drm/bridge/lontium-lt8912b.c b/drivers/gpu/drm/bridge/lontium-lt8912b.c
> index 61491615bad0..9a5a19655362 100644
> --- a/drivers/gpu/drm/bridge/lontium-lt8912b.c
> +++ b/drivers/gpu/drm/bridge/lontium-lt8912b.c
> @@ -635,13 +635,15 @@ static int lt8912_parse_dt(struct lt8912 *lt)
>  	lt->gp_reset = gp_reset;
>  
>  	endpoint = of_graph_get_endpoint_by_regs(dev->of_node, 0, -1);
> -	if (IS_ERR(endpoint)) {
> -		ret = PTR_ERR(endpoint);
> -		goto end;
> -	}
> +	if (!endpoint)
> +		return -ENODEV;
>  
>  	lt->data_lanes = of_property_count_u32_elems(endpoint, "data-lanes");
>  	of_node_put(endpoint);
> +	if (lt->data_lanes < 0) {

Ah flip.  Unfortunately, ->data_lanes is a u8 so it can't be negative.

> +		dev_err(lt->dev, "%s: Bad data-lanes property\n", __func__);
> +		return lt->data_lanes;
> +	}

regards,
dan carpenter

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v1 1/1] drm/bridge: lt8912b: Fix issues found during static analysis
  2021-03-31 10:29   ` Dan Carpenter
@ 2021-03-31 10:42     ` Adrien Grassein
  0 siblings, 0 replies; 4+ messages in thread
From: Adrien Grassein @ 2021-03-31 10:42 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: dri-devel

Le mer. 31 mars 2021 à 12:29, Dan Carpenter <dan.carpenter@oracle.com> a écrit :
>
> On Wed, Mar 31, 2021 at 11:38:22AM +0200, Adrien Grassein wrote:
> > Some issues where found during static analysis of this driver.
> >
> > Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> > Suggested-by: Dan Carpenter  <dan.carpenter@oracle.com>
> > Signed-off-by: Adrien Grassein <adrien.grassein@gmail.com>
> > ---
> >  drivers/gpu/drm/bridge/lontium-lt8912b.c | 20 ++++++++++++--------
> >  1 file changed, 12 insertions(+), 8 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/bridge/lontium-lt8912b.c b/drivers/gpu/drm/bridge/lontium-lt8912b.c
> > index 61491615bad0..9a5a19655362 100644
> > --- a/drivers/gpu/drm/bridge/lontium-lt8912b.c
> > +++ b/drivers/gpu/drm/bridge/lontium-lt8912b.c
> > @@ -635,13 +635,15 @@ static int lt8912_parse_dt(struct lt8912 *lt)
> >       lt->gp_reset = gp_reset;
> >
> >       endpoint = of_graph_get_endpoint_by_regs(dev->of_node, 0, -1);
> > -     if (IS_ERR(endpoint)) {
> > -             ret = PTR_ERR(endpoint);
> > -             goto end;
> > -     }
> > +     if (!endpoint)
> > +             return -ENODEV;
> >
> >       lt->data_lanes = of_property_count_u32_elems(endpoint, "data-lanes");
> >       of_node_put(endpoint);
> > +     if (lt->data_lanes < 0) {
>
> Ah flip.  Unfortunately, ->data_lanes is a u8 so it can't be negative.
>
oups ^^.

> > +             dev_err(lt->dev, "%s: Bad data-lanes property\n", __func__);
> > +             return lt->data_lanes;
> > +     }
>
> regards,
> dan carpenter
>
Thanks,
Adrien
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-03-31 10:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-31  9:38 [PATCH v1 0/1] Fixes 30e2ae943c26 "drm/bridge: Introduce LT8912B DSI to HDMI Adrien Grassein
2021-03-31  9:38 ` [PATCH v1 1/1] drm/bridge: lt8912b: Fix issues found during static analysis Adrien Grassein
2021-03-31 10:29   ` Dan Carpenter
2021-03-31 10:42     ` Adrien Grassein

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.