diff mbox series

of: fdt: remove unnecessary codes

Message ID 20210701140457epcms1p2cc43a7c62150f012619feab913f017af@epcms1p2
State Accepted
Commit eb7173988caf6fc68ef00065b9defb5ac3467f21
Headers show
Series of: fdt: remove unnecessary codes | expand

Commit Message

권오훈 July 1, 2021, 2:04 p.m. UTC
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(-)

Comments

Rob Herring (Arm) July 14, 2021, 10:50 p.m. UTC | #1
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!
diff mbox series

Patch

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,