From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from relay4-d.mail.gandi.net ([217.70.183.196]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jONhP-0000Ws-Jx for barebox@lists.infradead.org; Tue, 14 Apr 2020 15:42:09 +0000 From: Ahmad Fatoum Date: Tue, 14 Apr 2020 17:41:51 +0200 Message-Id: <20200414154151.1528591-1-ahmad@a3f.at> In-Reply-To: <20200414064609.GV27288@pengutronix.de> References: <20200414064609.GV27288@pengutronix.de> MIME-Version: 1.0 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "barebox" Errors-To: barebox-bounces+u.kleine-koenig=pengutronix.de@lists.infradead.org Subject: [PATCH] fixup! of: port Linux of_get_compatible_child helper To: barebox@lists.infradead.org Cc: Sascha Hauer The barebox implementation of for_each_child_of_node doesn't set the iterator to NULL, when the list of children is empty. Fix of_get_compatible_child to deal with this. Suggested-by: Sascha Hauer Signed-off-by: Ahmad Fatoum --- drivers/of/base.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/of/base.c b/drivers/of/base.c index 5a0374a82c5c..1223e0ab558f 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c @@ -1730,10 +1730,10 @@ struct device_node *of_get_compatible_child(const struct device_node *parent, for_each_child_of_node(parent, child) { if (of_device_is_compatible(child, compatible)) - break; + return child; } - return child; + return NULL; } EXPORT_SYMBOL(of_get_compatible_child); -- 2.20.1 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox