Kernel/NVMe: Fix calculation of "Maximum Queue Entries Supported" field

The value of this field is incremented by one, as a value of 0 for this
field means 1 entry supported.

A value of 0xffff for CAP.MQES would incorrectly by truncated to 0x0000,
if we don't increase the bit width of the return type.
This commit is contained in:
Sönke Holz 2024-03-03 22:07:38 +01:00 committed by Andrew Kaster
parent 760b9186a5
commit 6daa0da3c6

View file

@ -54,7 +54,7 @@ static constexpr u8 CAP_DBL_SHIFT = 32;
static constexpr u8 CAP_DBL_MASK = 0xf;
static constexpr u8 CAP_TO_SHIFT = 24;
static constexpr u64 CAP_TO_MASK = 0xff << CAP_TO_SHIFT;
static constexpr u16 MQES(u64 cap)
static constexpr u32 MQES(u64 cap)
{
return (cap & 0xffff) + 1;
}