tests: drivers: counter: Fix coverity issue

Fix issue reported by Coverity - return value not checked.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
This commit is contained in:
Krzysztof Chruscinski 2019-11-14 09:57:41 +01:00 committed by Kumar Gala
parent 2d8f71049e
commit 46aae2e86a

View file

@ -130,15 +130,19 @@ static bool set_top_value_capable(const char *dev_name)
struct counter_top_cfg cfg = {
.ticks = counter_get_top_value(dev) - 1
};
int err;
int err = counter_set_top_value(dev, &cfg);
err = counter_set_top_value(dev, &cfg);
if (err == -ENOTSUP) {
return false;
}
cfg.ticks++;
counter_set_top_value(dev, &cfg);
err = counter_set_top_value(dev, &cfg);
if (err == -ENOTSUP) {
return false;
}
return true;
}