diff mbox series

board: phytec: common: Fix phytec_get_product_name()

Message ID 20250408071710.3618157-1-primoz.fiser@norik.com
State Accepted
Commit 4c0d377858e3ffccd803e4e4177f93347a400436
Headers show
Series board: phytec: common: Fix phytec_get_product_name() | expand

Commit Message

Primoz Fiser April 8, 2025, 7:17 a.m. UTC
Currently, phytec_get_product_name() function only takes care of PCM
SoM type, however in case of PCL, KSM or KSP SoM type it will return
error:

  phytec_get_product_name: Invalid SOM type

Add support for other SoM types as defined in phytec_som_type_str enum
(see phytec_som_detection.h) to get rid of the error.

While at it, also simplify switch case statements by grouping them
together. This makes it more concise and readable.

Signed-off-by: Primoz Fiser <primoz.fiser@norik.com>
Reviewed-by: Daniel Schultz <d.schultz@phytec.de>
---
 board/phytec/common/phytec_som_detection.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

Comments

Tom Rini April 16, 2025, 2:10 p.m. UTC | #1
On Tue, 08 Apr 2025 09:17:10 +0200, Primoz Fiser wrote:

> Currently, phytec_get_product_name() function only takes care of PCM
> SoM type, however in case of PCL, KSM or KSP SoM type it will return
> error:
> 
>   phytec_get_product_name: Invalid SOM type
> 
> Add support for other SoM types as defined in phytec_som_type_str enum
> (see phytec_som_detection.h) to get rid of the error.
> 
> [...]

Applied to u-boot/master, thanks!

[1/1] board: phytec: common: Fix phytec_get_product_name()
      commit: 4c0d377858e3ffccd803e4e4177f93347a400436
diff mbox series

Patch

diff --git a/board/phytec/common/phytec_som_detection.c b/board/phytec/common/phytec_som_detection.c
index 1f2213902edb..4d7c9b9f80f6 100644
--- a/board/phytec/common/phytec_som_detection.c
+++ b/board/phytec/common/phytec_som_detection.c
@@ -295,17 +295,16 @@  static int phytec_get_product_name(struct phytec_eeprom_data *data,
 
 	switch (api2->som_type) {
 	case 0:
+	case 1:
+	case 2:
+	case 3:
 		som_type = api2->som_type;
 		break;
 	case 4:
-		som_type = 0;
-		break;
 	case 5:
 		som_type = 0;
 		break;
 	case 6:
-		som_type = 1;
-		break;
 	case 7:
 		som_type = 1;
 		break;