mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] iio: Fix uninitialized symbol 'ret'
@ 2024-10-31  1:45 Zicheng Qu
  2024-10-31  7:13 ` Matti Vaittinen
  0 siblings, 1 reply; 6+ messages in thread
From: Zicheng Qu @ 2024-10-31  1:45 UTC (permalink / raw)
  To: mazziesaccount, jic23, lars, linux-iio, linux-kernel
  Cc: tanghui20, zhangqiao22, judy.chenhui, quzicheng

Initialize the variable ret at the time of declaration to prevent it from
being returned without a defined value. Fixes smatch warning:
drivers/iio/industrialio-gts-helper.c:256 gain_to_scaletables() error:
uninitialized symbol 'ret'.

Cc: stable@vger.kernel.org # v6.6+
Fixes: 38416c28e168 ("iio: light: Add gain-time-scale helpers")
Signed-off-by: Zicheng Qu <quzicheng@huawei.com>
---
 drivers/iio/industrialio-gts-helper.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/industrialio-gts-helper.c b/drivers/iio/industrialio-gts-helper.c
index 59d7615c0f56..c5dc5b51693d 100644
--- a/drivers/iio/industrialio-gts-helper.c
+++ b/drivers/iio/industrialio-gts-helper.c
@@ -167,7 +167,7 @@ static int iio_gts_gain_cmp(const void *a, const void *b)
 
 static int gain_to_scaletables(struct iio_gts *gts, int **gains, int **scales)
 {
-	int ret, i, j, new_idx, time_idx;
+	int i, j, new_idx, time_idx, ret = 0;
 	int *all_gains;
 	size_t gain_bytes;
 
-- 
2.34.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-11-02  9:46 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-10-31  1:45 [PATCH] iio: Fix uninitialized symbol 'ret' Zicheng Qu
2024-10-31  7:13 ` Matti Vaittinen
2024-10-31 21:47   ` Jonathan Cameron
2024-11-02  9:46     ` Matti Vaittinen
2024-11-01  3:43   ` Zicheng Qu
2024-11-02  9:45     ` Matti Vaittinen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®