Skip to content

Commit 90ca275

Browse files
committed
tests: fix ms byte decoding
get_lba_format_size incorrectly treats the 'ms' field as a power-of-2 exponent. Signed-off-by: Daniel Wagner <wagi@kernel.org>
1 parent e5262c9 commit 90ca275

1 file changed

Lines changed: 2 additions & 7 deletions

File tree

tests/nvme_test.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -315,14 +315,9 @@ def get_lba_format_size(self):
315315
self.assertTrue(len(json_output['lbafs']) > self.flbas,
316316
"Error : could not match the given flbas to an existing lbaf")
317317
lbaf_json = json_output['lbafs'][int(self.flbas)]
318-
ms_expo = int(lbaf_json['ms'])
318+
ms = int(lbaf_json['ms'])
319319
ds_expo = int(lbaf_json['ds'])
320-
ds = 0
321-
ms = 0
322-
if ds_expo > 0:
323-
ds = (1 << ds_expo)
324-
if ms_expo > 0:
325-
ms = (1 << ms_expo)
320+
ds = (1 << ds_expo) if ds_expo > 0 else 0
326321
return (ds, ms)
327322

328323
def get_ncap(self):

0 commit comments

Comments
 (0)