From 27a2c36c9538c7e5536a1b20fd74f0fc911d7950 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 8 May 2024 05:43:39 +0200 Subject: Merging upstream version 4.19.269. Signed-off-by: Daniel Baumann --- tools/iio/iio_utils.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'tools/iio/iio_utils.c') diff --git a/tools/iio/iio_utils.c b/tools/iio/iio_utils.c index 55272fef3..d60a25257 100644 --- a/tools/iio/iio_utils.c +++ b/tools/iio/iio_utils.c @@ -546,6 +546,10 @@ static int calc_digits(int num) { int count = 0; + /* It takes a digit to represent zero */ + if (!num) + return 1; + while (num != 0) { num /= 10; count++; -- cgit v1.2.3