Skip to content

Commit 1717a0b

Browse files
authored
Merge pull request #4721 from ldoolitt/main
kernel/drivertools.h: avoid maybe-uninitialized compile warnings
2 parents 956313e + 3ae9ca7 commit 1717a0b

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

kernel/drivertools.h

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ struct DriveBit
364364

365365
unsigned int hash() const
366366
{
367-
unsigned int inner;
367+
unsigned int inner = 0;
368368
switch (type_)
369369
{
370370
case DriveType::NONE:
@@ -385,6 +385,9 @@ struct DriveBit
385385
case DriveType::MULTIPLE:
386386
inner = multiple_.hash();
387387
break;
388+
default:
389+
log_abort();
390+
break;
388391
}
389392
return mkhash((unsigned int)type_, inner);
390393
}
@@ -912,7 +915,7 @@ struct DriveChunk
912915

913916
unsigned int hash() const
914917
{
915-
unsigned int inner;
918+
unsigned int inner = 0;
916919
switch (type_)
917920
{
918921
case DriveType::NONE:
@@ -933,6 +936,9 @@ struct DriveChunk
933936
case DriveType::MULTIPLE:
934937
inner = multiple_.hash();
935938
break;
939+
default:
940+
log_abort();
941+
break;
936942
}
937943
return mkhash((unsigned int)type_, inner);
938944
}

0 commit comments

Comments
 (0)