Fixes 30e2ae943c26 "drm/bridge: Introduce LT8912B DSI to HDMI"
v2 cover Fixes 30e2ae943c26 "drm/bridge: Introduce LT8912B DSI to HDMI"
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 | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-)
Signature · 6 lines
2.25.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v2 1/1 drm/bridge: lt8912b: Fix issues found during static analysis
Some issues where found during static analysis of this driver.
--- drivers/gpu/drm/bridge/lontium-lt8912b.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-)
drivers/gpu/drm/bridge/lontium-lt8912b.c +15 -9
@@ -622,6 +622,7 @@ static int lt8912_parse_dt(struct lt8912 *lt)struct gpio_desc *gp_reset;struct device *dev = lt->dev;int ret =0 ; +int data_lanes;struct device_node *port_node;struct device_node *endpoint;
@@ -635,13 +636,16 @@ 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" ); + data_lanes =of_property_count_u32_elems (endpoint,"data-lanes" );of_node_put (endpoint); +if (data_lanes <0 ) { +dev_err (lt->dev,"%s: Bad data-lanes property\n" , __func__); +return lt->data_lanes; + } + lt->data_lanes = data_lanes; lt->host_node =of_graph_get_remote_node (dev->of_node,0 ,-1 );if (!lt->host_node) {
@@ -658,16 +662,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);
Signature · 6 lines
2.25.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v2 1/1] drm/bridge: lt8912b: Fix issues found during static analysis
Quoted 7 lines · Adrien Grassein
drivers/gpu/drm/bridge/lontium-lt8912b.c +0
-3@@ -635,13 +636,16 @@ 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;
drivers/gpu/drm/bridge/lontium-lt8912b.c static int lt8912_parse_dt(struct lt8912 *lt) · line 646
Quoted 10 lines
drivers/gpu/drm/bridge/lontium-lt8912b.c +6
-2- } +if (!endpoint) +return -ENODEV ; - lt->data_lanes =of_property_count_u32_elems (endpoint,"data-lanes" ); + data_lanes =of_property_count_u32_elems (endpoint,"data-lanes" );of_node_put (endpoint); +if (data_lanes <0 ) { +dev_err (lt->dev,"%s: Bad data-lanes property\n" , __func__); +return lt->data_lanes;
return data_lanes;
Quoted 18 lines
drivers/gpu/drm/bridge/lontium-lt8912b.c +6
-4+ } + lt->data_lanes = data_lanes; lt->host_node =of_graph_get_remote_node (dev->of_node,0 ,-1 );if (!lt->host_node) {@@ -658,16 +662,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;
drivers/gpu/drm/bridge/lontium-lt8912b.c static int lt8912_parse_dt(struct lt8912 *lt) · line 679
Quoted 10 lines
drivers/gpu/drm/bridge/lontium-lt8912b.c +2
-0}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);
Also, btw the success path does "return ret;" but it would be nicer to "return 0;".
regards,
dan carpenter
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel