drm/mgag200: don't use uninitialized variables in mga_g200se_set_plls()
Jan Beulich
JBeulich at suse.com
Tue Oct 20 08:00:33 PDT 2015
>>> On 20.10.15 at 16:47, <mathieu.larouche at matrox.com> wrote:
> On 19/10/2015 6:29 AM, Jan Beulich wrote:
>> --- 4.3-rc6/drivers/gpu/drm/mgag200/mgag200_mode.c
>> +++ 4.3-rc6-mgag200-uninit/drivers/gpu/drm/mgag200/mgag200_mode.c
>> @@ -194,7 +194,7 @@ static int mga_g200se_set_plls(struct mg
>> }
>> }
>>
>> - fvv = pllreffreq * testn / testm;
>> + fvv = pllreffreq * n / m;
>> fvv = (fvv - 800000) / 50000;
>>
>> if (fvv > 15)
>>
> If you are using n/m instead of testn/testm, you need to
> add 1 to the variables to keep consistency. However, you
> have the same issue where m/n could be used without being
> initialized. So, I propose to keep testm, testn & testp
> and initialized them with the default value.
That makes them initialized, but since testn and testm are used
as loop variables I don't see how initializing them to default
values helps overcome the other half of the problem described
(them having a constant, pre-determined value at the end of
the loops: testn=257, testm=33). As to testp - it is always
initialized anyway (so long as P_ARRAY_SIZE is not zero). And
in the if() branch initialization isn't needed either, since the
variables aren't being used after the loops.
Jan
More information about the dri-devel
mailing list