[DC21X4] Fix uninitialized variable read (#6984)

This is the network driver which is used for MSVPC 2007.

I spotted it during a WIP-backport-experiment of the driver, when compiling with GCC4.7.2, which warned about it.
GCC8.4.0 unfortunately is blind to that on master head, for unknown reasons. Not good.
MSVC github buildbot is also blind to that on master head, for unknown reasons. Not good.
We later found that at least Clang did also warn about it on master head.
This commit is contained in:
Joachim Henze 2024-06-13 21:24:23 +02:00 committed by GitHub
parent 2d9a4b4a87
commit 3e6f65ffcd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -326,7 +326,7 @@ MediaInitDefaultMedia(
_In_ PDC21X4_ADAPTER Adapter, _In_ PDC21X4_ADAPTER Adapter,
_In_ ULONG MediaNumber) _In_ ULONG MediaNumber)
{ {
ULONG Csr14, MiiAdvertising, MiiControl, i; ULONG Csr14, i;
BOOLEAN UseMii; BOOLEAN UseMii;
PAGED_CODE(); PAGED_CODE();
@ -471,12 +471,14 @@ MediaInitDefaultMedia(
} }
else else
{ {
ULONG MiiAdvertising, MiiControl;
Adapter->DefaultMedia = MEDIA_MII; Adapter->DefaultMedia = MEDIA_MII;
switch (MediaNumber) switch (MediaNumber)
{ {
case MEDIA_10T: case MEDIA_10T:
MiiAdvertising = MII_ADV_10T_HD; MiiAdvertising = MII_ADV_10T_HD;
MiiControl = 0;
break; break;
case MEDIA_10T_FD: case MEDIA_10T_FD:
MiiAdvertising = MII_ADV_10T_FD; MiiAdvertising = MII_ADV_10T_FD;
@ -491,9 +493,9 @@ MediaInitDefaultMedia(
MiiControl = MII_CR_FULL_DUPLEX | MII_CR_SPEED_SELECTION; MiiControl = MII_CR_FULL_DUPLEX | MII_CR_SPEED_SELECTION;
break; break;
case MEDIA_100T4: case MEDIA_100T4:
MiiAdvertising = MII_ADV_100T4 | MII_CR_SPEED_SELECTION; MiiAdvertising = MII_ADV_100T4;
MiiControl = MII_CR_SPEED_SELECTION;
break; break;
default: default:
MiiAdvertising = 0; MiiAdvertising = 0;
MiiControl = 0; MiiControl = 0;