drm/mxsfb/lcdif: simplify remote pointer management using __free

Putting the remote device_node reference requires a of_node_put(remote) in
two places. Use a cleanup action to simplify the code.

Reviewed-by: Liu Ying <[email protected]>
Tested-by: Martyn Welch <[email protected]>
Tested-by: Alexander Stein <[email protected]> # TQMa8MPxL/MBa8MPxL
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Luca Ceresoli <[email protected]>
This commit is contained in:
Luca Ceresoli committed 2026-04-14 13:52:31 +02:00
1 parent 9022f01097
commit 1bff813f88
1 file changed
+4 -6
+4 -6
View File
@@ -5,6 +5,7 @@
* This code is based on drivers/gpu/drm/mxsfb/mxsfb*
*/
#include <linux/cleanup.h>
#include <linux/clk.h>
#include <linux/dma-mapping.h>
#include <linux/io.h>
@@ -53,16 +54,13 @@ static int lcdif_attach_bridge(struct lcdif_drm_private *lcdif)
int ret;
for_each_endpoint_of_node(dev->of_node, ep) {
struct device_node *remote;
struct device_node *remote __free(device_node) =
of_graph_get_remote_port_parent(ep);
struct of_endpoint of_ep;
struct drm_encoder *encoder;
remote = of_graph_get_remote_port_parent(ep);
if (!of_device_is_available(remote)) {
of_node_put(remote);
if (!of_device_is_available(remote))
continue;
}
of_node_put(remote);
ret = of_graph_parse_endpoint(ep, &of_ep);
if (ret < 0) {