Skip to content
Commit 74c420e0 authored by Gustavo A. R. Silva's avatar Gustavo A. R. Silva Committed by Jonathan Cameron
Browse files

iio: cros_ec_accel_legacy: Refactor code in cros_ec_accel_legacy_probe



Refactor some code in order to fix both the technical implementation
and the following warnings:

drivers/iio/accel/cros_ec_accel_legacy.c: In function ‘cros_ec_accel_legacy_probe’:
drivers/iio/accel/cros_ec_accel_legacy.c:387:36: warning: this statement may fall through [-Wimplicit-fallthrough=]
    ec_accel_channels[X].scan_index = Y;
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
drivers/iio/accel/cros_ec_accel_legacy.c:388:3: note: here
   case Y:
   ^~~~
drivers/iio/accel/cros_ec_accel_legacy.c:389:36: warning: this statement may fall through [-Wimplicit-fallthrough=]
    ec_accel_channels[Y].scan_index = X;
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
drivers/iio/accel/cros_ec_accel_legacy.c:390:3: note: here
   case Z:
   ^~~~

Notice that neither the for loop nor the switch statement is needed.
Also, "state->sign[Y] = 1" should be unconditional.

This patch is part of the ongoing efforts to enable
-Wimplicit-fallthrough.

Signed-off-by: default avatarGustavo A. R. Silva <gustavo@embeddedor.com>
Acked-by: default avatarKees Cook <keescook@chromium.org>
Acked-by: default avatarEnric Balletbo i Serra <enric.balletbo@collabora.com>
Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
parent f6672544
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment