hellcreek_led_setup() walks the two LED child nodes of the "leds" node with of_get_next_available_child(). The helper drops the reference on the child passed to it and takes one on the child it returns. After the second call the caller holds a reference on the second LED node. That reference is never dropped. The out: label only releases the "leds" node itself. Boards with both LED child nodes leak one device_node reference per probe, on the registration failures as well as on the success path. Drop it at the out: label, before the parent node. The early exits, where the walk stopped before the second child, pass NULL, which of_node_put() ignores. Found during a code review of the OF node handling in DSA drivers. Signed-off-by: Xia Yan --- drivers/net/dsa/hirschmann/hellcreek_ptp.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/dsa/hirschmann/hellcreek_ptp.c b/drivers/net/dsa/hirschmann/hellcreek_ptp.c index cb23bea9c21b..ed27731d4f4e 100644 --- a/drivers/net/dsa/hirschmann/hellcreek_ptp.c +++ b/drivers/net/dsa/hirschmann/hellcreek_ptp.c @@ -392,6 +392,7 @@ static int hellcreek_led_setup(struct hellcreek *hellcreek) ret = 0; out: + of_node_put(led); of_node_put(leds); return ret;