[1/1] dm: core: remove redundant assignment
diff mbox series

Message ID 20200215204604.21926-1-xypron.glpk@gmx.de
State Accepted
Delegated to: Simon Glass
Headers show
Series
  • [1/1] dm: core: remove redundant assignment
Related show

Commit Message

Heinrich Schuchardt Feb. 15, 2020, 8:46 p.m. UTC
Variable count is initialized at the start of every round of the while
loop and it is not used after the while loop. So there is no need to
initialize it beforehand.

Identified by cppcheck.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
---
 drivers/core/of_access.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--
2.25.0

Comments

Simon Glass Feb. 16, 2020, 7:03 p.m. UTC | #1
On Sat, 15 Feb 2020 at 13:46, Heinrich Schuchardt <xypron.glpk@gmx.de> wrote:
>
> Variable count is initialized at the start of every round of the while
> loop and it is not used after the while loop. So there is no need to
> initialize it beforehand.
>
> Identified by cppcheck.
>
> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
> ---
>  drivers/core/of_access.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>

Reviewed-by: Simon Glass <sjg@chromium.org>
Simon Glass March 3, 2020, 2:46 a.m. UTC | #2
On Sat, 15 Feb 2020 at 13:46, Heinrich Schuchardt <xypron.glpk@gmx.de> wrote:
>
> Variable count is initialized at the start of every round of the while
> loop and it is not used after the while loop. So there is no need to
> initialize it beforehand.
>
> Identified by cppcheck.
>
> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
> ---
>  drivers/core/of_access.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>

Reviewed-by: Simon Glass <sjg@chromium.org>

Applied to u-boot-dm, thanks!

Patch
diff mbox series

diff --git a/drivers/core/of_access.c b/drivers/core/of_access.c
index acd745c121..29e705e0b6 100644
--- a/drivers/core/of_access.c
+++ b/drivers/core/of_access.c
@@ -577,7 +577,7 @@  static int __of_parse_phandle_with_args(const struct device_node *np,
 {
 	const __be32 *list, *list_end;
 	int rc = 0, cur_index = 0;
-	uint32_t count = 0;
+	uint32_t count;
 	struct device_node *node = NULL;
 	phandle phandle;
 	int size;