Skip to contentSkip to conversation

mfd: max77620: Fix FPS switch statements

PATCH Applied Rhyland Klein 5 participants 9 messages May 12, 2016 – Jun 15, 2016

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

PATCH 1/1 mfd: max77620: Fix FPS switch statements

When configuring FPS during probe, assuming a DT node is present for FPS, the code can run into a problem with the switch statements in max77620_config_fps() and max77620_get_fps_period_reg_value(). Namely, in the case of chip->chip_id == MAX77620, it will set fps_[mix|max]_period but then fall through to the default switch case and return -EINVAL. Returning this from max77620_config_fps() will cause probe to fail.

---
 drivers/mfd/max77620.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/mfd/max77620.c +2 -0
index 199d261990be..f32fbb8e8129 100644
@@ -203,6 +203,7 @@ static int max77620_get_fps_period_reg_value(struct max77620_chip *chip,
 		break;
 	case MAX77620:
 		fps_min_period = MAX77620_FPS_PERIOD_MIN_US;
+		break;
 	default:
 		return -EINVAL;
 	}
@@ -236,6 +237,7 @@ static int max77620_config_fps(struct max77620_chip *chip,
 		break;
 	case MAX77620:
 		fps_max_period = MAX77620_FPS_PERIOD_MAX_US;
+		break;
 	default:
 		return -EINVAL;
 	}
Signature · 1 line
1.9.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · Rhyland Klein

When configuring FPS during probe, assuming a DT node is present for FPS, the code can run into a problem with the switch statements in max77620_config_fps() and max77620_get_fps_period_reg_value(). Namely, in the case of chip->chip_id == MAX77620, it will set fps_[mix|max]_period but then fall through to the default switch case and return -EINVAL. Returning this from max77620_config_fps() will cause probe to fail.

Thanks for fixes.
Missed when converting if-else to switch.

#2 lore raw
Quoted 11 lines · Laxman Dewangan
Quoted 8 lines · Rhyland Klein

When configuring FPS during probe, assuming a DT node is present for FPS, the code can run into a problem with the switch statements in max77620_config_fps() and max77620_get_fps_period_reg_value(). Namely, in the case of chip->chip_id == MAX77620, it will set fps_[mix|max]_period but then fall through to the default switch case and return -EINVAL. Returning this from max77620_config_fps() will cause probe to fail.

Quoted 5 lines

Thanks for fixes.
Missed when converting if-else to switch.

Lee, I noticed this hasn't been merged yet, but without it platforms using the max77620 can easily (if it has FPS nodes) fail to probe. Is there anything blocking it?

-rhyland

Signature · 1 line
nvpublic
#3 lore raw
Quoted 15 lines · Rhyland Klein
Quoted 14 lines · Laxman Dewangan
Quoted 8 lines · Rhyland Klein

When configuring FPS during probe, assuming a DT node is present for FPS, the code can run into a problem with the switch statements in max77620_config_fps() and max77620_get_fps_period_reg_value(). Namely, in the case of chip->chip_id == MAX77620, it will set fps_[mix|max]_period but then fall through to the default switch case and return -EINVAL. Returning this from max77620_config_fps() will cause probe to fail.

Thanks for fixes.
Missed when converting if-else to switch.

Quoted 6 lines
Quoted 2 lines

Lee, I noticed this hasn't been merged yet, but without it platforms using the max77620 can easily (if it has FPS nodes) fail to probe. Is there anything blocking it?

Yes, it was sent too late in the cycle.

Signature · 4 lines
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
#4 lore raw
Quoted 17 lines · Lee Jones
Quoted 15 lines · Rhyland Klein
Quoted 14 lines · Laxman Dewangan
Quoted 8 lines · Rhyland Klein

When configuring FPS during probe, assuming a DT node is present for FPS, the code can run into a problem with the switch statements in max77620_config_fps() and max77620_get_fps_period_reg_value(). Namely, in the case of chip->chip_id == MAX77620, it will set fps_[mix|max]_period but then fall through to the default switch case and return -EINVAL. Returning this from max77620_config_fps() will cause probe to fail.

Thanks for fixes.
Missed when converting if-else to switch.

Quoted 9 lines
Quoted 6 lines
Quoted 2 lines

Lee, I noticed this hasn't been merged yet, but without it platforms using the max77620 can easily (if it has FPS nodes) fail to probe. Is there anything blocking it?

Yes, it was sent too late in the cycle.

Ok, thanks.

-rhyland

Signature · 1 line
nvpublic
Reviewed-by Tested-by
#5 lore raw
In reply to Lee Jones
Quoted 17 lines · Lee Jones
Quoted 15 lines · Rhyland Klein
Quoted 14 lines · Laxman Dewangan
Quoted 8 lines · Rhyland Klein

When configuring FPS during probe, assuming a DT node is present for FPS, the code can run into a problem with the switch statements in max77620_config_fps() and max77620_get_fps_period_reg_value(). Namely, in the case of chip->chip_id == MAX77620, it will set fps_[mix|max]_period but then fall through to the default switch case and return -EINVAL. Returning this from max77620_config_fps() will cause probe to fail.

Thanks for fixes.
Missed when converting if-else to switch.

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

Lee, I noticed this hasn't been merged yet, but without it platforms using the max77620 can easily (if it has FPS nodes) fail to probe. Is there anything blocking it?

Yes, it was sent too late in the cycle.

Can we still have this for v4.7? It's clearly -rc material.

Applied
#6 lore raw
In reply to Rhyland Klein
Quoted 8 lines · Rhyland Klein

When configuring FPS during probe, assuming a DT node is present for FPS, the code can run into a problem with the switch statements in max77620_config_fps() and max77620_get_fps_period_reg_value(). Namely, in the case of chip->chip_id == MAX77620, it will set fps_[mix|max]_period but then fall through to the default switch case and return -EINVAL. Returning this from max77620_config_fps() will cause probe to fail.

Quoted 4 lines
---
 drivers/mfd/max77620.c | 2 ++
 1 file changed, 2 insertions(+)

Applied to -fixes with Thierry and Laxman's Acks.

Quoted 20 lines
drivers/mfd/max77620.c +2 -0
index 199d261990be..f32fbb8e8129 100644
@@ -203,6 +203,7 @@ static int max77620_get_fps_period_reg_value(struct max77620_chip *chip,
 		break;
 	case MAX77620:
 		fps_min_period = MAX77620_FPS_PERIOD_MIN_US;
+		break;
 	default:
 		return -EINVAL;
 	}
@@ -236,6 +237,7 @@ static int max77620_config_fps(struct max77620_chip *chip,
 		break;
 	case MAX77620:
 		fps_max_period = MAX77620_FPS_PERIOD_MAX_US;
+		break;
 	default:
 		return -EINVAL;
 	}
Signature · 4 lines
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
#7 lore raw
Quoted 10 lines · Lee Jones
Quoted 8 lines · Rhyland Klein

When configuring FPS during probe, assuming a DT node is present for FPS, the code can run into a problem with the switch statements in max77620_config_fps() and max77620_get_fps_period_reg_value(). Namely, in the case of chip->chip_id == MAX77620, it will set fps_[mix|max]_period but then fall through to the default switch case and return -EINVAL. Returning this from max77620_config_fps() will cause probe to fail.

Quoted 7 lines
Quoted 4 lines
---
 drivers/mfd/max77620.c | 2 ++
 1 file changed, 2 insertions(+)

Applied to -fixes with Thierry and Laxman's Acks.

I don't see this in linux-next yet (as of 20160614). Can we get this merged there to.

-rhyland

Signature · 1 line
nvpublic
#8 lore raw
Quoted 16 lines · Rhyland Klein
Quoted 15 lines · Lee Jones
Quoted 12 lines · Rhyland Klein

When configuring FPS during probe, assuming a DT node is present for FPS, the code can run into a problem with the switch statements in max77620_config_fps() and max77620_get_fps_period_reg_value(). Namely, in the case of chip->chip_id == MAX77620, it will set fps_[mix|max]_period but then fall through to the default switch case and return -EINVAL. Returning this from max77620_config_fps() will cause probe to fail.

---
 drivers/mfd/max77620.c | 2 ++
 1 file changed, 2 insertions(+)
Quoted 5 lines
Quoted 2 lines

Applied to -fixes with Thierry and Laxman's Acks.

I don't see this in linux-next yet (as of 20160614). Can we get this merged there to.

Was about to say the same thing. FWIW: