Skip to contentSkip to conversation

drm: sun4i: sun6i_mipi_dsi: Mark expected switch fall-through

PATCH In review Anders Roxell 1 participant 1 message Jul 26, 2019

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 drm: sun4i: sun6i_mipi_dsi: Mark expected switch fall-through

When fall-through warnings was enabled by default the following warning was starting to show up:

../drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c: In function ‘sun6i_dsi_transfer’:../drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c:992:6: warning:
this statement may fall through [-Wimplicit-fallthrough=]

   if (msg->rx_len == 1) {
      ^

../drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c:997:2: note: here
default:
^~~~~~~

Rework so that the compiler doesn't warn about fall-through. Change the if-statement so that we can move out 'break;' one level.

Fixes d93512ef0f0e ("Makefile: Globally enable fall-through warning")
---
 drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c +3 -1
index 472f73985deb..40ed21e527f9 100644
@@ -992,8 +992,10 @@ static ssize_t sun6i_dsi_transfer(struct mipi_dsi_host *host,
 	case MIPI_DSI_DCS_READ:
 		if (msg->rx_len == 1) {
 			ret = sun6i_dsi_dcs_read(dsi, msg);
-			break;
+		} else {
+			ret = -EINVAL;
 		}
+		break;
 
 	default:
 		ret = -EINVAL;
Signature · 1 line
2.20.1