Skip to content

Commit

Permalink
drm/omap: dss: Fix refcount leak bugs
Browse files Browse the repository at this point in the history
In dss_init_ports() and __dss_uninit_ports(), we should call
of_node_put() for the reference returned by of_graph_get_port_by_id()
in fail path or when it is not used anymore.

Fixes: 09bffa6 ("drm: omap: use common OF graph helpers")
Signed-off-by: Liang He <[email protected]>
Signed-off-by: Tomi Valkeinen <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
  • Loading branch information
windhl authored and tomba committed Sep 9, 2022
1 parent e8523f5 commit 8b42057
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/gpu/drm/omapdrm/dss/dss.c
Original file line number Diff line number Diff line change
Expand Up @@ -1176,6 +1176,7 @@ static void __dss_uninit_ports(struct dss_device *dss, unsigned int num_ports)
default:
break;
}
of_node_put(port);
}
}

Expand Down Expand Up @@ -1208,11 +1209,13 @@ static int dss_init_ports(struct dss_device *dss)
default:
break;
}
of_node_put(port);
}

return 0;

error:
of_node_put(port);
__dss_uninit_ports(dss, i);
return r;
}
Expand Down

0 comments on commit 8b42057

Please sign in to comment.