devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] of: fdt: remove unnecessary codes
       [not found] <CGME20210701140328epcms1p85149318b6c18fa18b3c7c8e966c14db0@epcms1p2>
@ 2021-07-01 14:04 ` 권오훈
  2021-07-14 22:50   ` Rob Herring
  0 siblings, 1 reply; 2+ messages in thread
From: 권오훈 @ 2021-07-01 14:04 UTC (permalink / raw)
  To: robh+dt, frowand.list
  Cc: lee.jones, 권오훈,
	ohkwon1043, devicetree, linux-kernel

While unflattening the device tree, we try to populate dt nodes and
properties into tree-shaped data structure.

In populate_properties function, pprev is initially set to
&np->properties, and then updated to &pp->next.

In both scenarios *pprev is NULL, since the memory area that we are
allocating from is initially zeroed.

I tested the code as below, and it showed that BUG was never called.

-       if (!dryrun)
+       if (!dryrun) {
+               if (*pprev)
+                       BUG();
                *pprev = NULL;
+       }

Let's remove unnecessary code.

Signed-off-by: Ohhoon Kwon <ohoono.kwon@samsung.com>
---
 drivers/of/fdt.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index ba17a80b8c79..5e71f5eb35b1 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -200,9 +200,6 @@ static void populate_properties(const void *blob,
 				 nodename, (char *)pp->value);
 		}
 	}
-
-	if (!dryrun)
-		*pprev = NULL;
 }
 
 static int populate_node(const void *blob,
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] of: fdt: remove unnecessary codes
  2021-07-01 14:04 ` [PATCH] of: fdt: remove unnecessary codes 권오훈
@ 2021-07-14 22:50   ` Rob Herring
  0 siblings, 0 replies; 2+ messages in thread
From: Rob Herring @ 2021-07-14 22:50 UTC (permalink / raw)
  To: 권오훈
  Cc: frowand.list, linux-kernel, devicetree, ohkwon1043, robh+dt, lee.jones

On Thu, 01 Jul 2021 23:04:57 +0900, 권오훈 wrote:
> While unflattening the device tree, we try to populate dt nodes and
> properties into tree-shaped data structure.
> 
> In populate_properties function, pprev is initially set to
> &np->properties, and then updated to &pp->next.
> 
> In both scenarios *pprev is NULL, since the memory area that we are
> allocating from is initially zeroed.
> 
> I tested the code as below, and it showed that BUG was never called.
> 
> -       if (!dryrun)
> +       if (!dryrun) {
> +               if (*pprev)
> +                       BUG();
>                 *pprev = NULL;
> +       }
> 
> Let's remove unnecessary code.
> 
> Signed-off-by: Ohhoon Kwon <ohoono.kwon@samsung.com>
> ---
>  drivers/of/fdt.c | 3 ---
>  1 file changed, 3 deletions(-)
> 

Applied, thanks!

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-07-14 22:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20210701140328epcms1p85149318b6c18fa18b3c7c8e966c14db0@epcms1p2>
2021-07-01 14:04 ` [PATCH] of: fdt: remove unnecessary codes 권오훈
2021-07-14 22:50   ` Rob Herring

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).