diff mbox series

[U-Boot,2/7] common: avb_verify: Fix invalid 'for' loop condition

Message ID 20180814004309.15271-2-erosca@de.adit-jv.com
State Accepted
Commit 2e2067b815b0fc96f357abc8cd54eedd8148c44d
Delegated to: Tom Rini
Headers show
Series [U-Boot,1/7] libavb: Handle wrong hashtree_error_mode in avb_append_options() | expand

Commit Message

Eugeniu Rosca Aug. 14, 2018, 12:43 a.m. UTC
Fix below compiler [1] warning:

common/avb_verify.c: In function ‘avb_find_dm_args’:
common/avb_verify.c:179:30: warning: left-hand operand of comma expression has no effect [-Wunused-value]
  for (i = 0; i < AVB_MAX_ARGS, args[i]; ++i) {

[1] aarch64-linux-gnu-gcc (Linaro GCC 7.2-2017.11)

Signed-off-by: Eugeniu Rosca <erosca@de.adit-jv.com>
---
 common/avb_verify.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Igor Opaniuk Aug. 16, 2018, 8:34 a.m. UTC | #1
Reviewed-by: Igor Opaniuk <igor.opaniuk@linaro.org>

On 14 August 2018 at 03:43, Eugeniu Rosca <roscaeugeniu@gmail.com> wrote:
> Fix below compiler [1] warning:
>
> common/avb_verify.c: In function ‘avb_find_dm_args’:
> common/avb_verify.c:179:30: warning: left-hand operand of comma expression has no effect [-Wunused-value]
>   for (i = 0; i < AVB_MAX_ARGS, args[i]; ++i) {
>
> [1] aarch64-linux-gnu-gcc (Linaro GCC 7.2-2017.11)
>
> Signed-off-by: Eugeniu Rosca <erosca@de.adit-jv.com>
> ---
>  common/avb_verify.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/common/avb_verify.c b/common/avb_verify.c
> index 20e35ade3029..e6f3f207ff6f 100644
> --- a/common/avb_verify.c
> +++ b/common/avb_verify.c
> @@ -176,7 +176,7 @@ static int avb_find_dm_args(char **args, char *str)
>         if (!str)
>                 return -1;
>
> -       for (i = 0; i < AVB_MAX_ARGS, args[i]; ++i) {
> +       for (i = 0; i < AVB_MAX_ARGS && args[i]; ++i) {
>                 if (strstr(args[i], str))
>                         return i;
>         }
> --
> 2.18.0
>
Tom Rini Aug. 24, 2018, 8:09 p.m. UTC | #2
On Tue, Aug 14, 2018 at 02:43:04AM +0200, Eugeniu Rosca wrote:

> Fix below compiler [1] warning:
> 
> common/avb_verify.c: In function ‘avb_find_dm_args’:
> common/avb_verify.c:179:30: warning: left-hand operand of comma expression has no effect [-Wunused-value]
>   for (i = 0; i < AVB_MAX_ARGS, args[i]; ++i) {
> 
> [1] aarch64-linux-gnu-gcc (Linaro GCC 7.2-2017.11)
> 
> Signed-off-by: Eugeniu Rosca <erosca@de.adit-jv.com>
> Reviewed-by: Igor Opaniuk <igor.opaniuk@linaro.org>

Applied to u-boot/master, thanks!
diff mbox series

Patch

diff --git a/common/avb_verify.c b/common/avb_verify.c
index 20e35ade3029..e6f3f207ff6f 100644
--- a/common/avb_verify.c
+++ b/common/avb_verify.c
@@ -176,7 +176,7 @@  static int avb_find_dm_args(char **args, char *str)
 	if (!str)
 		return -1;
 
-	for (i = 0; i < AVB_MAX_ARGS, args[i]; ++i) {
+	for (i = 0; i < AVB_MAX_ARGS && args[i]; ++i) {
 		if (strstr(args[i], str))
 			return i;
 	}