When reading the fault attribute, an empty string was printed if the
fault register value was non-zero.
This is fixed by checking that the return value is less than zero
instead of not zero.
Also always print two hex digits while we are touching this line.
Signed-off-by: David Lechner <dlechner@baylibre.com>
Link: https://lore.kernel.org/r/20230921144400.62380-4-dlechner@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
ret = ad2s1210_config_read(st, AD2S1210_REG_FAULT);
mutex_unlock(&st->lock);
- return ret ? ret : sprintf(buf, "0x%x\n", ret);
+ return ret < 0 ? ret : sprintf(buf, "0x%02x\n", ret);
}
static ssize_t ad2s1210_clear_fault(struct device *dev,