All of lore.kernel.org
 help / color / mirror / Atom feed
* [bug report] drm/bridge: Introduce LT8912B DSI to HDMI bridge
@ 2021-03-31  8:12 Dan Carpenter
  2021-03-31  8:14 ` Dan Carpenter
  0 siblings, 1 reply; 5+ messages in thread
From: Dan Carpenter @ 2021-03-31  8:12 UTC (permalink / raw)
  To: adrien.grassein; +Cc: dri-devel

Hello Adrien Grassein,

The patch 30e2ae943c26: "drm/bridge: Introduce LT8912B DSI to HDMI
bridge" from Mar 26, 2021, leads to the following static checker
warning:

	drivers/gpu/drm/bridge/lontium-lt8912b.c:638 lt8912_parse_dt()
	warn: 'endpoint' isn't an ERR_PTR

drivers/gpu/drm/bridge/lontium-lt8912b.c
   620  static int lt8912_parse_dt(struct lt8912 *lt)
   621  {
   622          struct gpio_desc *gp_reset;
   623          struct device *dev = lt->dev;
   624          int ret = 0;
   625          struct device_node *port_node;
   626          struct device_node *endpoint;
   627  
   628          gp_reset = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH);
   629          if (IS_ERR(gp_reset)) {
   630                  ret = PTR_ERR(gp_reset);
   631                  if (ret != -EPROBE_DEFER)
   632                          dev_err(dev, "Failed to get reset gpio: %d\n", ret);
   633                  return ret;
   634          }
   635          lt->gp_reset = gp_reset;
   636  
   637          endpoint = of_graph_get_endpoint_by_regs(dev->of_node, 0, -1);
   638          if (IS_ERR(endpoint)) {

Endpoint isn't an error pointer.  You could just delete this check if
you wanted and check of_property_count_u32_elems() for errors.

   639                  ret = PTR_ERR(endpoint);
   640                  goto end;

goto end is a do nothing goto.  Genereally direct returns are more
readable have fewer bugs (based on ten years of reviewing static
analysis warnings).

   641          }
   642  
   643          lt->data_lanes = of_property_count_u32_elems(endpoint, "data-lanes");

Either way, it's probably a good idea to check if
of_property_count_u32_elems() fails.

   644          of_node_put(endpoint);
   645  
   646          lt->host_node = of_graph_get_remote_node(dev->of_node, 0, -1);
   647          if (!lt->host_node) {
   648                  dev_err(lt->dev, "%s: Failed to get remote port\n", __func__);
   649                  ret = -ENODEV;
   650                  goto end;
   651          }
   652  
   653          port_node = of_graph_get_remote_node(dev->of_node, 1, -1);
   654          if (!port_node) {
   655                  dev_err(lt->dev, "%s: Failed to get connector port\n", __func__);
   656                  ret = -ENODEV;
   657                  goto err_free_host_node;
   658          }
   659  
   660          lt->hdmi_port = of_drm_find_bridge(port_node);
   661          if (IS_ERR(lt->hdmi_port)) {
   662                  dev_err(lt->dev, "%s: Failed to get hdmi port\n", __func__);
   663                  ret = PTR_ERR(lt->hdmi_port);
   664                  of_node_put(lt->host_node);
   665                  goto end;

This should call of_node_put(port_node); then goto err_free_host_node;

   666          }
   667  
   668          if (!of_device_is_compatible(port_node, "hdmi-connector")) {
   669                  dev_err(lt->dev, "%s: Failed to get hdmi port\n", __func__);
   670                  ret = -EINVAL;

This should call of_node_put(port_node); then goto err_free_host_node;
as well.

   671          }
   672  
   673          of_node_put(port_node);
   674  
   675  end:
   676          return ret;
   677  
   678  err_free_host_node:
   679          of_node_put(lt->host_node);
   680          return ret;
   681  }

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] 5+ messages in thread

* Re: [bug report] drm/bridge: Introduce LT8912B DSI to HDMI bridge
  2021-03-31  8:12 [bug report] drm/bridge: Introduce LT8912B DSI to HDMI bridge Dan Carpenter
@ 2021-03-31  8:14 ` Dan Carpenter
  2021-03-31  9:17   ` Adrien Grassein
  0 siblings, 1 reply; 5+ messages in thread
From: Dan Carpenter @ 2021-03-31  8:14 UTC (permalink / raw)
  To: adrien.grassein; +Cc: dri-devel

On Wed, Mar 31, 2021 at 11:12:38AM +0300, Dan Carpenter wrote:
>    644          of_node_put(endpoint);
>    645  
>    646          lt->host_node = of_graph_get_remote_node(dev->of_node, 0, -1);
>    647          if (!lt->host_node) {
>    648                  dev_err(lt->dev, "%s: Failed to get remote port\n", __func__);
>    649                  ret = -ENODEV;
>    650                  goto end;
>    651          }
>    652  
>    653          port_node = of_graph_get_remote_node(dev->of_node, 1, -1);
>    654          if (!port_node) {
>    655                  dev_err(lt->dev, "%s: Failed to get connector port\n", __func__);
>    656                  ret = -ENODEV;
>    657                  goto err_free_host_node;
>    658          }
>    659  
>    660          lt->hdmi_port = of_drm_find_bridge(port_node);
>    661          if (IS_ERR(lt->hdmi_port)) {

This isn't an error pointer either.  of_drm_find_bridge() returns NULL.

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] 5+ messages in thread

* Re: [bug report] drm/bridge: Introduce LT8912B DSI to HDMI bridge
  2021-03-31  8:14 ` Dan Carpenter
@ 2021-03-31  9:17   ` Adrien Grassein
  2021-03-31  9:27     ` Dan Carpenter
  0 siblings, 1 reply; 5+ messages in thread
From: Adrien Grassein @ 2021-03-31  9:17 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: dri-devel

Hello,

thanks for your review.

I will publish a patch soon.

What tag should I add to my commit to mention that you find bugs
(Suggested-by for example)?

Thanks;

Le mer. 31 mars 2021 à 10:14, Dan Carpenter <dan.carpenter@oracle.com> a écrit :
>
> On Wed, Mar 31, 2021 at 11:12:38AM +0300, Dan Carpenter wrote:
> >    644          of_node_put(endpoint);
> >    645
> >    646          lt->host_node = of_graph_get_remote_node(dev->of_node, 0, -1);
> >    647          if (!lt->host_node) {
> >    648                  dev_err(lt->dev, "%s: Failed to get remote port\n", __func__);
> >    649                  ret = -ENODEV;
> >    650                  goto end;
> >    651          }
> >    652
> >    653          port_node = of_graph_get_remote_node(dev->of_node, 1, -1);
> >    654          if (!port_node) {
> >    655                  dev_err(lt->dev, "%s: Failed to get connector port\n", __func__);
> >    656                  ret = -ENODEV;
> >    657                  goto err_free_host_node;
> >    658          }
> >    659
> >    660          lt->hdmi_port = of_drm_find_bridge(port_node);
> >    661          if (IS_ERR(lt->hdmi_port)) {
>
> This isn't an error pointer either.  of_drm_find_bridge() returns NULL.
>
> 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] 5+ messages in thread

* Re: [bug report] drm/bridge: Introduce LT8912B DSI to HDMI bridge
  2021-03-31  9:17   ` Adrien Grassein
@ 2021-03-31  9:27     ` Dan Carpenter
  2021-03-31  9:29       ` Adrien Grassein
  0 siblings, 1 reply; 5+ messages in thread
From: Dan Carpenter @ 2021-03-31  9:27 UTC (permalink / raw)
  To: Adrien Grassein; +Cc: dri-devel

On Wed, Mar 31, 2021 at 11:17:20AM +0200, Adrien Grassein wrote:
> Hello,
> 
> thanks for your review.
> 
> I will publish a patch soon.
> 
> What tag should I add to my commit to mention that you find bugs
> (Suggested-by for example)?

If there is a bug fix then please could you use Reported-by?

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] 5+ messages in thread

* Re: [bug report] drm/bridge: Introduce LT8912B DSI to HDMI bridge
  2021-03-31  9:27     ` Dan Carpenter
@ 2021-03-31  9:29       ` Adrien Grassein
  0 siblings, 0 replies; 5+ messages in thread
From: Adrien Grassein @ 2021-03-31  9:29 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: dri-devel

Le mer. 31 mars 2021 à 11:27, Dan Carpenter <dan.carpenter@oracle.com> a écrit :
>
> On Wed, Mar 31, 2021 at 11:17:20AM +0200, Adrien Grassein wrote:
> > Hello,
> >
> > thanks for your review.
> >
> > I will publish a patch soon.
> >
> > What tag should I add to my commit to mention that you find bugs
> > (Suggested-by for example)?
>
> If there is a bug fix then please could you use Reported-by?
>
I will do that + Suggested-by.
> regards,
> dan carpenter
>

Thanks again for your time and your review.

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

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

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

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-03-31  8:12 [bug report] drm/bridge: Introduce LT8912B DSI to HDMI bridge Dan Carpenter
2021-03-31  8:14 ` Dan Carpenter
2021-03-31  9:17   ` Adrien Grassein
2021-03-31  9:27     ` Dan Carpenter
2021-03-31  9:29       ` 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.