EON Steel: fix uninitialized field cache entries

The check for whether we had initialized a field in the EON Steel cache
data structure was wrong, causing some entries to be returned
successfully even if their field had never been initialized.

In most cases, it didn't matter, since the cache data was initialized to
zero (which is a fine default for uninitialized data), so most of the
time it didn't matter.

But for the recently added dive mode field, this caused OC dives to be
returned as freedives, for example.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Linus Torvalds 2016-07-16 15:39:19 +09:00 committed by Jef Driesen
parent c6b681a753
commit 42601825aa

View File

@ -955,7 +955,7 @@ suunto_eonsteel_parser_get_field(dc_parser_t *parser, dc_field_type_t type, unsi
suunto_eonsteel_parser_t *eon = (suunto_eonsteel_parser_t *)parser;
if (!(eon->cache.initialized >> type))
if (!(eon->cache.initialized & (1 << type)))
return DC_STATUS_UNSUPPORTED;
switch (type) {