diff mbox series

hwmon: replace impossible fallthroughs with breaks

Message ID 20200831113958.GB514373@mwanda (mailing list archive)
State Accepted
Headers show
Series hwmon: replace impossible fallthroughs with breaks | expand

Commit Message

Dan Carpenter Aug. 31, 2020, 11:39 a.m. UTC
It's impossible to reach these fall through statements because all
the possible values are handled.  In that situation it's cleaner to
use a break statement instead of a fall through statement.

Fixes: c947e51cf803 ("hwmon: (adt7462) Mark expected switch fall-throughs")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/hwmon/adt7462.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Guenter Roeck Aug. 31, 2020, 2:31 p.m. UTC | #1
On Mon, Aug 31, 2020 at 02:39:58PM +0300, Dan Carpenter wrote:
> It's impossible to reach these fall through statements because all
> the possible values are handled.  In that situation it's cleaner to
> use a break statement instead of a fall through statement.
> 

Makes sense. Applied.

Thanks,
Guenter

> Fixes: c947e51cf803 ("hwmon: (adt7462) Mark expected switch fall-throughs")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
>  drivers/hwmon/adt7462.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/hwmon/adt7462.c b/drivers/hwmon/adt7462.c
> index e75bbd87ad09..634a44591c7f 100644
> --- a/drivers/hwmon/adt7462.c
> +++ b/drivers/hwmon/adt7462.c
> @@ -435,7 +435,7 @@ static const char *voltage_label(struct adt7462_data *data, int which)
>  		case 3:
>  			return "+1.5V";
>  		}
> -		fallthrough;
> +		break;
>  	case 2:
>  		if (!(data->pin_cfg[1] & ADT7462_PIN22_INPUT))
>  			return "+12V3";
> @@ -493,7 +493,7 @@ static const char *voltage_label(struct adt7462_data *data, int which)
>  		case 3:
>  			return "+1.5";
>  		}
> -		fallthrough;
> +		break;
>  	case 11:
>  		if (data->pin_cfg[3] >> ADT7462_PIN28_SHIFT ==
>  					ADT7462_PIN28_VOLT &&
> @@ -531,7 +531,7 @@ static int voltage_multiplier(struct adt7462_data *data, int which)
>  		case 3:
>  			return 7800;
>  		}
> -		fallthrough;
> +		break;
>  	case 2:
>  		if (!(data->pin_cfg[1] & ADT7462_PIN22_INPUT))
>  			return 62500;
> @@ -589,7 +589,7 @@ static int voltage_multiplier(struct adt7462_data *data, int which)
>  		case 3:
>  			return 7800;
>  		}
> -		fallthrough;
> +		break;
>  	case 11:
>  	case 12:
>  		if (data->pin_cfg[3] >> ADT7462_PIN28_SHIFT ==
diff mbox series

Patch

diff --git a/drivers/hwmon/adt7462.c b/drivers/hwmon/adt7462.c
index e75bbd87ad09..634a44591c7f 100644
--- a/drivers/hwmon/adt7462.c
+++ b/drivers/hwmon/adt7462.c
@@ -435,7 +435,7 @@  static const char *voltage_label(struct adt7462_data *data, int which)
 		case 3:
 			return "+1.5V";
 		}
-		fallthrough;
+		break;
 	case 2:
 		if (!(data->pin_cfg[1] & ADT7462_PIN22_INPUT))
 			return "+12V3";
@@ -493,7 +493,7 @@  static const char *voltage_label(struct adt7462_data *data, int which)
 		case 3:
 			return "+1.5";
 		}
-		fallthrough;
+		break;
 	case 11:
 		if (data->pin_cfg[3] >> ADT7462_PIN28_SHIFT ==
 					ADT7462_PIN28_VOLT &&
@@ -531,7 +531,7 @@  static int voltage_multiplier(struct adt7462_data *data, int which)
 		case 3:
 			return 7800;
 		}
-		fallthrough;
+		break;
 	case 2:
 		if (!(data->pin_cfg[1] & ADT7462_PIN22_INPUT))
 			return 62500;
@@ -589,7 +589,7 @@  static int voltage_multiplier(struct adt7462_data *data, int which)
 		case 3:
 			return 7800;
 		}
-		fallthrough;
+		break;
 	case 11:
 	case 12:
 		if (data->pin_cfg[3] >> ADT7462_PIN28_SHIFT ==