Skip to contentSkip to conversation

video: fbdev: pxafb: add missing of_node_put() in of_get_pxafb_mode_info()

PATCH In review Wei Yongjun 3 participants 3 messages Aug 13, 2016 – Aug 30, 2016 Framebuffer layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 video: fbdev: pxafb: add missing of_node_put() in of_get_pxafb_mode_info()

This node pointer is returned by of_graph_get_next_endpoint() with refcount incremented in this function. of_node_put() on it before exitting this function.

Found by Coccinelle.

---
 drivers/video/fbdev/pxafb.c | 1 +
 1 file changed, 1 insertion(+)
drivers/video/fbdev/pxafb.c +1 -0
index ed41fdb..ef73f14 100644
@@ -2186,6 +2186,7 @@ static int of_get_pxafb_mode_info(struct device *dev,
 	ret = of_property_read_u32(np, "bus-width", &bus_width);
 	if (ret) {
 		dev_err(dev, "no bus-width specified: %d\n", ret);
+		of_node_put(np);
 		return ret;
 	}
 
#2 lore raw
In reply to Wei Yongjun
Quoted 16 lines · Wei Yongjun

This node pointer is returned by of_graph_get_next_endpoint() with refcount incremented in this function. of_node_put() on it before exitting this function.

Found by Coccinelle.

---
 drivers/video/fbdev/pxafb.c | 1 +
 1 file changed, 1 insertion(+)
drivers/video/fbdev/pxafb.c +0 -0
index ed41fdb..ef73f14 100644

drivers/video/fbdev/pxafb.c static int of_get_pxafb_mode_info(struct device *dev, · line 2192

Quoted 7 lines
drivers/video/fbdev/pxafb.c +1 -0
@@ -2186,6 +2186,7 @@ static int of_get_pxafb_mode_info(struct device *dev,
 	ret = of_property_read_u32(np, "bus-width", &bus_width);
 	if (ret) {
 		dev_err(dev, "no bus-width specified: %d\n", ret);
+		of_node_put(np);
 		return ret;
 	}
 

Thanks, queued for 4.9.

Tomi