Skip to contentSkip to conversation

regulator: tps65910: Add missing breaks in switch/case

PATCH Applied Axel Lin 3 participants 3 messages Jul 10, 2011 – Jul 22, 2011

Subsystems (2)

v2 of 3 Applied Latest is v3 →

lore
Share & tools
lore

Axel Lin

author
#0 lore raw

PATCH v2 1/1 regulator: tps65910: Add missing breaks in switch/case

Also add a default case in tps65910_list_voltage_dcdc to silence 'volt' may be used uninitialized in this function warning.

---
v2: Just found another missing breaks in tps65910_list_voltage_dcdc.
And also silence the 'volt' may be used uninitialized warning by adding a default case.

 drivers/regulator/tps65910-regulator.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
drivers/regulator/tps65910-regulator.c +6 -0
index 55dd4e6..fe8dc02 100644
@@ -759,8 +759,12 @@ static int tps65910_list_voltage_dcdc(struct regulator_dev *dev,
 		mult = (selector / VDD1_2_NUM_VOLTS) + 1;
 		volt = VDD1_2_MIN_VOLT +
 				(selector % VDD1_2_NUM_VOLTS) * VDD1_2_OFFSET;
+		break;
 	case TPS65911_REG_VDDCTRL:
 		volt = VDDCTRL_MIN_VOLT + (selector * VDDCTRL_OFFSET);
+		break;
+	default:
+		return -EINVAL;
 	}
 
 	return  volt * 100 * mult;
@@ -898,9 +902,11 @@ static __devinit int tps65910_probe(struct platform_device *pdev)
 	case TPS65910:
 		pmic->get_ctrl_reg = &tps65910_get_ctrl_register;
 		info = tps65910_regs;
+		break;
 	case TPS65911:
 		pmic->get_ctrl_reg = &tps65911_get_ctrl_register;
 		info = tps65911_regs;
+		break;
 	default:
 		pr_err("Invalid tps chip version\n");
 		return -ENODEV;
Signature · 1 line
1.7.4.1
Acked-by on v2 1/1
#1 lore raw
Quoted 4 lines · Axel Lin

Also add a default case in tps65910_list_voltage_dcdc to silence 'volt' may be used uninitialized in this function warning.

though for the default case I'd suggest also adding a BUG() as if that happens either the driver is confused or the core is making up regulators for us.

#2 lore raw
Quoted 4 lines · Mark Brown
Quoted 3 lines · Axel Lin

Also add a default case in tps65910_list_voltage_dcdc to silence 'volt' may be used uninitialized in this function warning.

Quoted 8 lines
Quoted 1 line

though for the default case I'd suggest also adding a BUG() as if that happens either the driver is confused or the core is making up regulators for us.
--

Applied.

Thanks

Liam