Re: [igt-dev] [PATCH i-g-t 24/25] gem_wsim: Discover engines

Tvrtko Ursulin
2019-05-17T13:05:38Z

On 17/05/2019 14:02, Andi Shyti wrote:
>>>> +static void query_engines(void)
>>>> +{
>>>> + struct i915_engine_class_instance *engines;
>>>> + unsigned int num;
>>>> +
>>>> + if (__engines_queried)
>>>> + return;
>>>> +
>>>> + __engines_queried = true;
>>>> +
>>>> + if (!has_query(fd) || !has_engine_query(fd)) {
>
> [...]
>
>>>> + unsigned int num_bsd = gem_has_bsd(fd) + gem_has_bsd2(fd);
>>>> + unsigned int i = 0;
>>>> +
>>>> + igt_assert(num);
>>>> +
>>>> + num = 1 + num_bsd;
>>>
>>> did you mean the above two lines swapped?
>>
>> No, I want to avoid running on platforms with no vcs engines since no one
>> ever tested gem_wsim there.
>
> but you are asserting on 'num' while num is not initialized.

True, my bad. Where are compiler warnings when you need them.

> so that I guess it should first be
>
> num = 1 + num_bsd;
>
> and then
>
> igt_assert(num);
>
> right?

I just want igt_assert(num_bsd).

Regards,

Tvrtko