Skip to contentSkip to conversation

io: core: mark expected switch fall-through

PATCH Superseded Gustavo A. R. Silva 3 participants 5 messages Nov 8, 2017 – Nov 19, 2017 IIO

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 io: core: mark expected switch fall-through

In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through.

Addresses-Coverity-ID: 1397962

---
 drivers/iio/industrialio-core.c | 1 +
 1 file changed, 1 insertion(+)
drivers/iio/industrialio-core.c +1 -0
index 9c4cfd1..2e8e36f 100644
@@ -588,6 +588,7 @@ static ssize_t __iio_format_value(char *buf, size_t len, unsigned int type,
 		return snprintf(buf, len, "%d", vals[0]);
 	case IIO_VAL_INT_PLUS_MICRO_DB:
 		scale_db = true;
+		/* fall through */
 	case IIO_VAL_INT_PLUS_MICRO:
 		if (vals[1] < 0)
 			return snprintf(buf, len, "-%d.%06u%s", abs(vals[0]),
Signature · 1 line
2.7.4
#1 lore raw
Quoted 3 lines

In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through.

please fix the subject line, should be
iio: core: Mark...

thx, p.

Quoted 19 lines

Addresses-Coverity-ID: 1397962

---
 drivers/iio/industrialio-core.c | 1 +
 1 file changed, 1 insertion(+)
drivers/iio/industrialio-core.c +1 -0
index 9c4cfd1..2e8e36f 100644
@@ -588,6 +588,7 @@ static ssize_t __iio_format_value(char *buf, size_t len, unsigned int type,
 		return snprintf(buf, len, "%d", vals[0]);
 	case IIO_VAL_INT_PLUS_MICRO_DB:
 		scale_db = true;
+		/* fall through */
 	case IIO_VAL_INT_PLUS_MICRO:
 		if (vals[1] < 0)
 			return snprintf(buf, len, "-%d.%06u%s", abs(vals[0]),
Signature · 2 lines
Peter Meerwald-Stadler
Mobile: +43 664 24 44 418
#2 lore raw

Quoting Peter Meerwald-Stadler <[email protected]>:

Quoted 6 lines
Quoted 2 lines

In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through.

please fix the subject line, should be
iio: core: Mark...

Oh yeah. I'll send v2 shortly.

Thanks!
--
Gustavo A. R. Silva

#3 lore raw

PATCH v2 1/1 iio: core: Mark expected switch fall-through

In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through.

Addresses-Coverity-ID: 1397962

---
Changes in v2:
Fix subject line.

 drivers/iio/industrialio-core.c | 1 +
 1 file changed, 1 insertion(+)
drivers/iio/industrialio-core.c +1 -0
index 9c4cfd1..2e8e36f 100644
@@ -588,6 +588,7 @@ static ssize_t __iio_format_value(char *buf, size_t len, unsigned int type,
 		return snprintf(buf, len, "%d", vals[0]);
 	case IIO_VAL_INT_PLUS_MICRO_DB:
 		scale_db = true;
+		/* fall through */
 	case IIO_VAL_INT_PLUS_MICRO:
 		if (vals[1] < 0)
 			return snprintf(buf, len, "-%d.%06u%s", abs(vals[0]),
Signature · 1 line
2.7.4
maintainer Applied
#4 lore raw

Re: [PATCH v2] iio: core: Mark expected switch fall-through

Quoted 5 lines · On Wed, 8 Nov 2017 12:08:26 -0600 "Gustavo A. R. Silva"…

In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through.

Addresses-Coverity-ID: 1397962

Applied to the togreg branch of iio.git and will be pushed out as testing.

Thanks,

Jonathan

Quoted 19 lines

---
Changes in v2:
Fix subject line.

 drivers/iio/industrialio-core.c | 1 +
 1 file changed, 1 insertion(+)
drivers/iio/industrialio-core.c +1 -0
index 9c4cfd1..2e8e36f 100644
@@ -588,6 +588,7 @@ static ssize_t __iio_format_value(char *buf, size_t len, unsigned int type,
 		return snprintf(buf, len, "%d", vals[0]);
 	case IIO_VAL_INT_PLUS_MICRO_DB:
 		scale_db = true;
+		/* fall through */
 	case IIO_VAL_INT_PLUS_MICRO:
 		if (vals[1] < 0)
 			return snprintf(buf, len, "-%d.%06u%s", abs(vals[0]),