Skip to contentSkip to conversation

drm/amdgpu: remove dead code in atom_get_src_int

PATCH In review Jesse Zhang 2 participants 2 messages Jun 5, 2024

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

PATCH v2 4/12 drm/amdgpu: remove dead code in atom_get_src_int

Since the range of align is 0~7, the expression is: align = (attr >> 3) & 7. In the case of ATOM_ARG_IMM, the code cannot reach the default case. So there is no need for "break".

---
 drivers/gpu/drm/amd/amdgpu/atom.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/atom.c +4 -4
index d552e013354c..09715b506468 100644
@@ -301,7 +301,7 @@ static uint32_t atom_get_src_int(atom_exec_context *ctx, uint8_t attr,
 			(*ptr) += 4;
 			if (print)
 				DEBUG("IMM 0x%08X\n", val);
-			return val;
+			break;
 		case ATOM_SRC_WORD0:
 		case ATOM_SRC_WORD8:
 		case ATOM_SRC_WORD16:
@@ -309,7 +309,7 @@ static uint32_t atom_get_src_int(atom_exec_context *ctx, uint8_t attr,
 			(*ptr) += 2;
 			if (print)
 				DEBUG("IMM 0x%04X\n", val);
-			return val;
+			break;
 		case ATOM_SRC_BYTE0:
 		case ATOM_SRC_BYTE8:
 		case ATOM_SRC_BYTE16:
@@ -318,9 +318,9 @@ static uint32_t atom_get_src_int(atom_exec_context *ctx, uint8_t attr,
 			(*ptr)++;
 			if (print)
 				DEBUG("IMM 0x%02X\n", val);
-			return val;
+			break;
 		}
-		break;
+		return val;
 	case ATOM_ARG_PLL:
 		idx = U8(*ptr);
 		(*ptr)++;
Signature · 1 line
2.25.1
Reviewed-by on v2 4/12
#1 lore raw

[Public]

This patch is,

Quoted 61 lines

-----Original Message-----
From: Jesse Zhang <[email protected]>
Sent: Wednesday, June 5, 2024 4:34 PM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Huang, Tim <[email protected]>; Zhang, Jesse(Jie) <[email protected]>; Zhang, Jesse(Jie) <[email protected]>
Subject: [PATCH 4/12 V2] drm/amdgpu: remove dead code in atom_get_src_int

Since the range of align is 0~7, the expression is: align = (attr >> 3) & 7. In the case of ATOM_ARG_IMM, the code cannot reach the default case. So there is no need for "break".

---
 drivers/gpu/drm/amd/amdgpu/atom.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/atom.c +1 -1
index d552e013354c..09715b506468 100644
@@ -301,7 +301,7 @@ static uint32_t atom_get_src_int(atom_exec_context
 *ctx, uint8_t attr,
                      (*ptr) += 4;
                      if (print)
                              DEBUG("IMM 0x%08X\n", val);
-                     return val;
+                     break;
              case ATOM_SRC_WORD0:
              case ATOM_SRC_WORD8:

case ATOM_SRC_WORD16:

drivers/gpu/drm/amd/amdgpu/atom.c +1 -1
@@ -309,7 +309,7 @@ static uint32_t atom_get_src_int(atom_exec_context
 *ctx, uint8_t attr,
                      (*ptr) += 2;
                      if (print)
                              DEBUG("IMM 0x%04X\n", val);
-                     return val;
+                     break;
              case ATOM_SRC_BYTE0:
              case ATOM_SRC_BYTE8:

case ATOM_SRC_BYTE16:

drivers/gpu/drm/amd/amdgpu/atom.c +2 -2
@@ -318,9 +318,9 @@ static uint32_t atom_get_src_int(atom_exec_context
 *ctx, uint8_t attr,
                      (*ptr)++;
                      if (print)
                              DEBUG("IMM 0x%02X\n", val);
-                     return val;
+                     break;
              }
-             break;
+             return val;
      case ATOM_ARG_PLL:
              idx = U8(*ptr);
              (*ptr)++;

--
2.25.1