Re: [PATCH] hwmon: Mark expected switch fall-throughs

2018-07-03 Thread Jean Delvare
Hi Gustavo,

On Mon, 2 Jul 2018 16:30:17 -0500, Gustavo A. R. Silva wrote:
> In preparation to enabling -Wimplicit-fallthrough, mark switch cases
> where we are expecting to fall through.

That's a great initiative, thanks for doing that.

> Signed-off-by: Gustavo A. R. Silva 
> ---
>  drivers/hwmon/emc1403.c | 2 ++
>  drivers/hwmon/nct6775.c | 2 +-
>  2 files changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/hwmon/emc1403.c b/drivers/hwmon/emc1403.c
> index 1ea7ca5..aaebeb7 100644
> --- a/drivers/hwmon/emc1403.c
> +++ b/drivers/hwmon/emc1403.c
> @@ -443,8 +443,10 @@ static int emc1403_probe(struct i2c_client *client,
>   switch (id->driver_data) {
>   case emc1404:
>   data->groups[2] = _group;
> + /* fall through */
>   case emc1403:
>   data->groups[1] = _group;
> + /* fall through */
>   case emc1402:
>   data->groups[0] = _group;
>   }
> diff --git a/drivers/hwmon/nct6775.c b/drivers/hwmon/nct6775.c
> index 3714990..c6bd61e 100644
> --- a/drivers/hwmon/nct6775.c
> +++ b/drivers/hwmon/nct6775.c
> @@ -2541,7 +2541,7 @@ static void pwm_update_registers(struct nct6775_data 
> *data, int nr)
>   case thermal_cruise:
>   nct6775_write_value(data, data->REG_TARGET[nr],
>   data->target_temp[nr]);
> - /* intentional */
> + /* fall through  */

Do you know which -Wimplicit-fallthrough level we will be using? Level
1 would be happy with the initial comment, no change would be needed.
If level 2-4 then yes the change is needed.

>   default:
>   reg = nct6775_read_value(data, data->REG_FAN_MODE[nr]);
>   reg = (reg & ~data->tolerance_mask) |

Reviewed-by: Jean Delvare 

-- 
Jean Delvare
SUSE L3 Support
--
To unsubscribe from this list: send the line "unsubscribe linux-hwmon" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] hwmon: Mark expected switch fall-throughs

2018-07-02 Thread Gustavo A. R. Silva
In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.

Signed-off-by: Gustavo A. R. Silva 
---
 drivers/hwmon/emc1403.c | 2 ++
 drivers/hwmon/nct6775.c | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/hwmon/emc1403.c b/drivers/hwmon/emc1403.c
index 1ea7ca5..aaebeb7 100644
--- a/drivers/hwmon/emc1403.c
+++ b/drivers/hwmon/emc1403.c
@@ -443,8 +443,10 @@ static int emc1403_probe(struct i2c_client *client,
switch (id->driver_data) {
case emc1404:
data->groups[2] = _group;
+   /* fall through */
case emc1403:
data->groups[1] = _group;
+   /* fall through */
case emc1402:
data->groups[0] = _group;
}
diff --git a/drivers/hwmon/nct6775.c b/drivers/hwmon/nct6775.c
index 3714990..c6bd61e 100644
--- a/drivers/hwmon/nct6775.c
+++ b/drivers/hwmon/nct6775.c
@@ -2541,7 +2541,7 @@ static void pwm_update_registers(struct nct6775_data 
*data, int nr)
case thermal_cruise:
nct6775_write_value(data, data->REG_TARGET[nr],
data->target_temp[nr]);
-   /* intentional */
+   /* fall through  */
default:
reg = nct6775_read_value(data, data->REG_FAN_MODE[nr]);
reg = (reg & ~data->tolerance_mask) |
-- 
2.7.4

--
To unsubscribe from this list: send the line "unsubscribe linux-hwmon" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html