Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1475106pxk; Fri, 25 Sep 2020 16:19:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw/v0DXlXL8Pc0XUiFURPnrzKImB+mhRfz8rAa/RmvSNGz6uLqAy/cVKEdVTWsbZwnclrT9 X-Received: by 2002:a17:906:2dc1:: with SMTP id h1mr5078006eji.436.1601075985770; Fri, 25 Sep 2020 16:19:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601075985; cv=none; d=google.com; s=arc-20160816; b=NGGxaWQUQ+to6PN+ycxvXEpQbIIA+rvLFR4xPaWCT/BtF/QCvsn7sRBrZ+EUFFw6QR GXLHbSJWgiMJf2V4IBv2GiwbktWzHFKn0qz6Wdi0caQUPXx4s57L78Nadb+dxBQfpkn1 WWF66g/94pqlOAgB1NVCYrf7p6iJSMxwtSeXK1xhSESGq7Jgn3qH3yBLJatWknpszl1E 4TtGea2wDkdNhioslR0hjwGT/tHLcnKtzBWIu+r7ULhx8TvwWafvhZgNWnq7fBwJ3LEW PgQNPEJJ9CjNNkQidiwZxPv7tTXInwPNdri8IrOpkVnmnBRJybO4KTZzoLZye4KjoKzA YEMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:content-disposition:mime-version :message-id:subject:cc:to:from:date; bh=fSwVvVGxXcMn7jaH2Hbnkq7P8y97v17SKv6sCmn0eFQ=; b=nYXpOJ5z2BmQvcM6zSdg1T4oXMJizSYoG6uw9WnEqSQ3PbtX0P+HataJKwtEMPEcKn I0Ne/n9dbIl80KdbZ3K2CAHqfccLE8A5xz0OSs9Bj1LnmCfWXzyaKx7Ciuy9e80HIPOS K7WRKhoOmWvHBs97lvf0Xc26CNBMy4rI939skx8bil+aqzobT3ZbSHtxKbN2kQvjTDda ML6FtX/XrUt7Xp7cUr2kbPOaDDfmuI+IMs1rF33qZ85zpccKjZrTpoI2wbDyAcTmgo92 RRqEG0p/ozxeNVZLXr/mnp58wzA9lAsfyREM4Yeit1XcSGTCMM5Nj8AZZcGJUxxsnthE 6vRQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a20si3510308edj.252.2020.09.25.16.19.23; Fri, 25 Sep 2020 16:19:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729374AbgIYXS1 (ORCPT + 99 others); Fri, 25 Sep 2020 19:18:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51484 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729363AbgIYXS0 (ORCPT ); Fri, 25 Sep 2020 19:18:26 -0400 Received: from agrajag.zerfleddert.de (agrajag.zerfleddert.de [IPv6:2a01:4f8:bc:1de::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7F003C0613CE for ; Fri, 25 Sep 2020 16:18:26 -0700 (PDT) Received: by agrajag.zerfleddert.de (Postfix, from userid 1000) id 30D245B2053C; Sat, 26 Sep 2020 01:18:23 +0200 (CEST) Date: Sat, 26 Sep 2020 01:18:23 +0200 From: Tobias Jordan To: linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Pavel Machek , Dan Murphy , Marek =?iso-8859-1?Q?Beh=FAn?= Subject: [PATCH] leds: omnia: fix leak of device node iterator Message-ID: <20200925231823.GA15759@agrajag.zerfleddert.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In the error path of the for_each_available_child_of_node loop in omnia_leds_probe, add missing call to of_node_put to fix leaking the iterator. Fixes: 089381b27abe ("leds: initial support for Turris Omnia LEDs") Signed-off-by: Tobias Jordan --- drivers/leds/leds-turris-omnia.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/leds/leds-turris-omnia.c b/drivers/leds/leds-turris-omnia.c index bb23d8e16614..6c3d3d90f277 100644 --- a/drivers/leds/leds-turris-omnia.c +++ b/drivers/leds/leds-turris-omnia.c @@ -236,8 +236,10 @@ static int omnia_leds_probe(struct i2c_client *client, led = &leds->leds[0]; for_each_available_child_of_node(np, child) { ret = omnia_led_register(client, led, child); - if (ret < 0) + if (ret < 0) { + of_node_put(child); return ret; + } led += ret; } -- 2.20.1