diff mbox series

fwts_devicetree: clean up static analysis warning

Message ID 20210922084804.99060-1-colin.king@canonical.com
State Accepted
Headers show
Series fwts_devicetree: clean up static analysis warning | expand

Commit Message

Colin Ian King Sept. 22, 2021, 8:48 a.m. UTC
From: Colin Ian King <colin.king@canonical.com>

The variable length should be initialized to zero to clean up
an overly pedantic static analysis warning of an uninitialized
variable.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 src/lib/src/fwts_devicetree.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Alex Hung Sept. 22, 2021, 7:05 p.m. UTC | #1
On 2021-09-22 2:48 a.m., Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> The variable length should be initialized to zero to clean up
> an overly pedantic static analysis warning of an uninitialized
> variable.
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  src/lib/src/fwts_devicetree.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/lib/src/fwts_devicetree.c b/src/lib/src/fwts_devicetree.c
> index 5556446c..dcd5f5f0 100644
> --- a/src/lib/src/fwts_devicetree.c
> +++ b/src/lib/src/fwts_devicetree.c
> @@ -265,7 +265,7 @@ int fwts_dt_stringlist_count(
>  	const char *property)
>  {
>  	const char *list, *end;
> -	int length, count = 0;
> +	int length = 0, count = 0;
>  
>  	list = fdt_getprop(fdt, nodeoffset, property, &length);
>  	if (!list) {
> 


Acked-by: Alex Hung <alex.hung@canonical.com>
Ivan Hu Sept. 23, 2021, 2:38 a.m. UTC | #2
On 9/22/21 4:48 PM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> The variable length should be initialized to zero to clean up
> an overly pedantic static analysis warning of an uninitialized
> variable.
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  src/lib/src/fwts_devicetree.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/lib/src/fwts_devicetree.c b/src/lib/src/fwts_devicetree.c
> index 5556446c..dcd5f5f0 100644
> --- a/src/lib/src/fwts_devicetree.c
> +++ b/src/lib/src/fwts_devicetree.c
> @@ -265,7 +265,7 @@ int fwts_dt_stringlist_count(
>  	const char *property)
>  {
>  	const char *list, *end;
> -	int length, count = 0;
> +	int length = 0, count = 0;
>  
>  	list = fdt_getprop(fdt, nodeoffset, property, &length);
>  	if (!list) {
> 

Acked-by: Ivan Hu <ivan.hu@canonical.com>
diff mbox series

Patch

diff --git a/src/lib/src/fwts_devicetree.c b/src/lib/src/fwts_devicetree.c
index 5556446c..dcd5f5f0 100644
--- a/src/lib/src/fwts_devicetree.c
+++ b/src/lib/src/fwts_devicetree.c
@@ -265,7 +265,7 @@  int fwts_dt_stringlist_count(
 	const char *property)
 {
 	const char *list, *end;
-	int length, count = 0;
+	int length = 0, count = 0;
 
 	list = fdt_getprop(fdt, nodeoffset, property, &length);
 	if (!list) {