Thread (9 messages) 9 messages, 3 authors, 2018-12-04

[PATCH 3/3] staging: iio: adc: ad7280a: add braces to complex for loops

flat view
STALE2863d

From: Slawomir Stepien <hidden>
Date: 2018-12-02 11:58:03
Subsystem: analog devices inc iio drivers, iio subsystem and drivers, staging - industrial io, staging subsystem, the rest · Maintainers: Nuno Sá, Michael Hennerich, Jonathan Cameron, Greg Kroah-Hartman, Linus Torvalds

These for loops have just only one instruction as its body. However this
body is complex, so add braces to them.

Signed-off-by: Slawomir Stepien <redacted>
---
 drivers/staging/iio/adc/ad7280a.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/iio/adc/ad7280a.c b/drivers/staging/iio/adc/ad7280a.c
index 6faa85bf6f7e..6ec5a0d2a438 100644
--- a/drivers/staging/iio/adc/ad7280a.c
+++ b/drivers/staging/iio/adc/ad7280a.c
@@ -574,7 +574,7 @@ static int ad7280_channel_init(struct ad7280_state *st)
 	if (!st->channels)
 		return -ENOMEM;
 
-	for (dev = 0, cnt = 0; dev <= st->slave_num; dev++)
+	for (dev = 0, cnt = 0; dev <= st->slave_num; dev++) {
 		for (ch = AD7280A_CELL_VOLTAGE_1; ch <= AD7280A_AUX_ADC_6;
 			ch++, cnt++) {
 			if (ch < AD7280A_AUX_ADC_1)
@@ -584,6 +584,7 @@ static int ad7280_channel_init(struct ad7280_state *st)
 
 			ad7280_common_fields_init(st, cnt, dev, ch);
 		}
+	}
 
 	ad7280_all_voltage_channel_init(st, cnt, dev);
 	cnt++;
@@ -642,7 +643,7 @@ static int ad7280_attr_init(struct ad7280_state *st)
 	if (!st->iio_attr)
 		return -ENOMEM;
 
-	for (dev = 0, cnt = 0; dev <= st->slave_num; dev++)
+	for (dev = 0, cnt = 0; dev <= st->slave_num; dev++) {
 		for (ch = AD7280A_CELL_VOLTAGE_1; ch <= AD7280A_CELL_VOLTAGE_6;
 			ch++, cnt++) {
 			ret = ad7280_balance_switch_attr_init(st, cnt, dev, ch);
@@ -654,6 +655,7 @@ static int ad7280_attr_init(struct ad7280_state *st)
 			if (ret < 0)
 				return ret;
 		}
+	}
 
 	ad7280_attributes[cnt] = NULL;
 
-- 
2.19.2
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help