[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20210714223059.GA3653253@robh.at.kernel.org>
Date: Wed, 14 Jul 2021 16:30:59 -0600
From: Rob Herring <robh@...nel.org>
To: 권오훈 <ohoono.kwon@...sung.com>
Cc: "ohkwon1043@...il.com" <ohkwon1043@...il.com>,
"lee.jones@...aro.org" <lee.jones@...aro.org>,
"robh+dt@...nel.org" <robh+dt@...nel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"devicetree@...r.kernel.org" <devicetree@...r.kernel.org>,
"frowand.list@...il.com" <frowand.list@...il.com>
Subject: Re: [PATCH] of: base: remove unnecessary for loop
On Thu, 01 Jul 2021 23:03:28 +0900, 권오훈 wrote:
> In __of_get_next_child function, loop iteration for getting next node is
> unnecessary.
>
> for loop is already checking if next is NULL or not, and
> of_node_get(next) always returns next itself.
>
> Therefore checking return value in the if clause always evaluates to
> true, and thus it always breaks out from for loop in the first iteration.
>
> Remove the unnecessary for loop for readability.
>
> I tested the code as below, and it showed that BUG was never called.
>
> - for (; next; next = next->sibling)
> + for (; next; next = next->sibling) {
> if (of_node_get(next))
> break;
> + BUG();
> + }
>
> Signed-off-by: Ohhoon Kwon <ohoono.kwon@...sung.com>
> ---
> drivers/of/base.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
Applied, thanks!
Powered by blists - more mailing lists