[1/4] kms_content_protection: Fix log bug on 32-bit platforms.

Submitted by Eric Anholt on Nov. 14, 2018, 10:28 p.m.

Details

Message ID 20181114222832.22839-1-eric@anholt.net
State New
Series "Series without cover letter"
Headers show

Commit Message

Eric Anholt Nov. 14, 2018, 10:28 p.m.
long is different between 32 and 64 and should basically never be
used.  Fixes compiler warning about passing the wrong type.

Signed-off-by: Eric Anholt <eric@anholt.net>
---
 tests/kms_content_protection.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/tests/kms_content_protection.c b/tests/kms_content_protection.c
index 801eff66c272..bb9ecd3f4cde 100644
--- a/tests/kms_content_protection.c
+++ b/tests/kms_content_protection.c
@@ -89,7 +89,8 @@  wait_for_prop_value(igt_output_t *output, uint64_t expected,
 			return true;
 		usleep(1000);
 	}
-	igt_info("prop_value mismatch %ld != %ld\n", val, expected);
+	igt_info("prop_value mismatch %lld != %lld\n",
+		 (long long)val, (long long)expected);
 
 	return false;
 }

Comments

Ville Syrjala Nov. 15, 2018, 11:17 a.m.
On Wed, Nov 14, 2018 at 02:28:29PM -0800, Eric Anholt wrote:
> long is different between 32 and 64 and should basically never be
> used.  Fixes compiler warning about passing the wrong type.
> 
> Signed-off-by: Eric Anholt <eric@anholt.net>
> ---
>  tests/kms_content_protection.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/tests/kms_content_protection.c b/tests/kms_content_protection.c
> index 801eff66c272..bb9ecd3f4cde 100644
> --- a/tests/kms_content_protection.c
> +++ b/tests/kms_content_protection.c
> @@ -89,7 +89,8 @@ wait_for_prop_value(igt_output_t *output, uint64_t expected,
>  			return true;
>  		usleep(1000);
>  	}
> -	igt_info("prop_value mismatch %ld != %ld\n", val, expected);
> +	igt_info("prop_value mismatch %lld != %lld\n",
> +		 (long long)val, (long long)expected);

We use the ugly PRId64 & co. elsewhere for this.

Also FYI we have an igt-dev list now, so should post there rather than
on intel-gfx.

>  
>  	return false;
>  }
> -- 
> 2.19.1
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Eric Anholt Nov. 15, 2018, 6:51 p.m.
Ville Syrjälä <ville.syrjala@linux.intel.com> writes:

> On Wed, Nov 14, 2018 at 02:28:29PM -0800, Eric Anholt wrote:
>> long is different between 32 and 64 and should basically never be
>> used.  Fixes compiler warning about passing the wrong type.
>> 
>> Signed-off-by: Eric Anholt <eric@anholt.net>
>> ---
>>  tests/kms_content_protection.c | 3 ++-
>>  1 file changed, 2 insertions(+), 1 deletion(-)
>> 
>> diff --git a/tests/kms_content_protection.c b/tests/kms_content_protection.c
>> index 801eff66c272..bb9ecd3f4cde 100644
>> --- a/tests/kms_content_protection.c
>> +++ b/tests/kms_content_protection.c
>> @@ -89,7 +89,8 @@ wait_for_prop_value(igt_output_t *output, uint64_t expected,
>>  			return true;
>>  		usleep(1000);
>>  	}
>> -	igt_info("prop_value mismatch %ld != %ld\n", val, expected);
>> +	igt_info("prop_value mismatch %lld != %lld\n",
>> +		 (long long)val, (long long)expected);
>
> We use the ugly PRId64 & co. elsewhere for this.

My experience with those ugly macros is that people have a flinch when
trying to remember how they work and just ignore the issue instead,
leaving it for those that have to compile for 32.  I'll switch it,
though.

Hopefully i-g-t will get cross-compiling CI and merge requests at some
point so that these bugs can just never land in the first place.
Ville Syrjala Nov. 15, 2018, 8:40 p.m.
On Thu, Nov 15, 2018 at 10:51:51AM -0800, Eric Anholt wrote:
> Ville Syrjälä <ville.syrjala@linux.intel.com> writes:
> 
> > On Wed, Nov 14, 2018 at 02:28:29PM -0800, Eric Anholt wrote:
> >> long is different between 32 and 64 and should basically never be
> >> used.  Fixes compiler warning about passing the wrong type.
> >> 
> >> Signed-off-by: Eric Anholt <eric@anholt.net>
> >> ---
> >>  tests/kms_content_protection.c | 3 ++-
> >>  1 file changed, 2 insertions(+), 1 deletion(-)
> >> 
> >> diff --git a/tests/kms_content_protection.c b/tests/kms_content_protection.c
> >> index 801eff66c272..bb9ecd3f4cde 100644
> >> --- a/tests/kms_content_protection.c
> >> +++ b/tests/kms_content_protection.c
> >> @@ -89,7 +89,8 @@ wait_for_prop_value(igt_output_t *output, uint64_t expected,
> >>  			return true;
> >>  		usleep(1000);
> >>  	}
> >> -	igt_info("prop_value mismatch %ld != %ld\n", val, expected);
> >> +	igt_info("prop_value mismatch %lld != %lld\n",
> >> +		 (long long)val, (long long)expected);
> >
> > We use the ugly PRId64 & co. elsewhere for this.
> 
> My experience with those ugly macros is that people have a flinch when
> trying to remember how they work and just ignore the issue instead,
> leaving it for those that have to compile for 32.  I'll switch it,
> though.
> 
> Hopefully i-g-t will get cross-compiling CI and merge requests at some
> point so that these bugs can just never land in the first place.

I thought we already did 32bit builds. Hmm. I guess we enabled that
only for the kernel builds.