Blob Blame History Raw
From 14b284832e7dea6f54f0adfd7bed105548b94e57 Mon Sep 17 00:00:00 2001
From: Colin Ian King <colin.king@canonical.com>
Date: Mon, 8 Oct 2018 17:22:28 +0100
Subject: drm/amdgpu/powerplay: fix missing break in switch statements
Git-commit: 14b284832e7dea6f54f0adfd7bed105548b94e57
Patch-mainline: v4.20-rc1
References: bsc#1113722

There are several switch statements that are missing break statements.
Add missing breaks to handle any fall-throughs corner cases.

Detected by CoverityScan, CID#1457175 ("Missing break in switch")

Backporting notes:

  * applied patch in {fiji,iceland,tonga}_smc.c files
  * fixed similar bug in polaris10_smc.c

Fixes: 18aafc59b106 ("drm/amd/powerplay: implement fw related smu interface for iceland.")
Acked-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/amd/powerplay/smumgr/fiji_smc.c      |    2 ++
 drivers/gpu/drm/amd/powerplay/smumgr/iceland_smc.c   |    2 ++
 drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smc.c |    2 ++
 drivers/gpu/drm/amd/powerplay/smumgr/tonga_smc.c     |    2 ++
 4 files changed, 8 insertions(+)

--- a/drivers/gpu/drm/amd/powerplay/smumgr/fiji_smc.c
+++ b/drivers/gpu/drm/amd/powerplay/smumgr/fiji_smc.c
@@ -2193,6 +2193,7 @@ uint32_t fiji_get_offsetof(uint32_t type
 		case UcodeLoadStatus:
 			return offsetof(SMU73_SoftRegisters, UcodeLoadStatus);
 		}
+		break;
 	case SMU_Discrete_DpmTable:
 		switch (member) {
 		case UvdBootLevel:
@@ -2204,6 +2205,7 @@ uint32_t fiji_get_offsetof(uint32_t type
 		case LowSclkInterruptThreshold:
 			return offsetof(SMU73_Discrete_DpmTable, LowSclkInterruptThreshold);
 		}
+		break;
 	}
 	pr_warn("can't get the offset of type %x member %x\n", type, member);
 	return 0;
--- a/drivers/gpu/drm/amd/powerplay/smumgr/iceland_smc.c
+++ b/drivers/gpu/drm/amd/powerplay/smumgr/iceland_smc.c
@@ -2140,11 +2140,13 @@ uint32_t iceland_get_offsetof(uint32_t t
 		case UcodeLoadStatus:
 			return offsetof(SMU71_SoftRegisters, UcodeLoadStatus);
 		}
+		break;
 	case SMU_Discrete_DpmTable:
 		switch (member) {
 		case LowSclkInterruptThreshold:
 			return offsetof(SMU71_Discrete_DpmTable, LowSclkInterruptThreshold);
 		}
+		break;
 	}
 	pr_warn("can't get the offset of type %x member %x\n", type, member);
 	return 0;
--- a/drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smc.c
+++ b/drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smc.c
@@ -2211,6 +2211,7 @@ uint32_t polaris10_get_offsetof(uint32_t
 		case UcodeLoadStatus:
 			return offsetof(SMU74_SoftRegisters, UcodeLoadStatus);
 		}
+		break;
 	case SMU_Discrete_DpmTable:
 		switch (member) {
 		case UvdBootLevel:
@@ -2222,6 +2223,7 @@ uint32_t polaris10_get_offsetof(uint32_t
 		case LowSclkInterruptThreshold:
 			return offsetof(SMU74_Discrete_DpmTable, LowSclkInterruptThreshold);
 		}
+		break;
 	}
 	pr_warn("can't get the offset of type %x member %x\n", type, member);
 	return 0;
--- a/drivers/gpu/drm/amd/powerplay/smumgr/tonga_smc.c
+++ b/drivers/gpu/drm/amd/powerplay/smumgr/tonga_smc.c
@@ -2683,6 +2683,7 @@ uint32_t tonga_get_offsetof(uint32_t typ
 		case UcodeLoadStatus:
 			return offsetof(SMU72_SoftRegisters, UcodeLoadStatus);
 		}
+		break;
 	case SMU_Discrete_DpmTable:
 		switch (member) {
 		case UvdBootLevel:
@@ -2694,6 +2695,7 @@ uint32_t tonga_get_offsetof(uint32_t typ
 		case LowSclkInterruptThreshold:
 			return offsetof(SMU72_Discrete_DpmTable, LowSclkInterruptThreshold);
 		}
+		break;
 	}
 	pr_warn("can't get the offset of type %x member %x\n", type, member);
 	return 0;