Skip to contentSkip to conversation

accel/habanalabs: remove redundant assignment to pointer 'input'

PATCH Applied Colin Ian King 2 participants 2 messages Jan 6, 2024 – Jan 9, 2024

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

PATCH 1/1 accel/habanalabs: remove redundant assignment to pointer 'input'

From: Colin Ian King <[email protected]>

The pointer input is assigned a value that is not read, it is being re-assigned again later with the same value. Resolve this by moving the declaration to input into the if block.

Cleans up clang scan build warning:
warning: Value stored to 'input' during its initialization is never read [deadcode.DeadStores]

---
 drivers/accel/habanalabs/goya/goya_coresight.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/accel/habanalabs/goya/goya_coresight.c +1 -2
index 41cae5fd843b..3827ea4c02f7 100644
@@ -576,7 +576,6 @@ static int goya_config_spmu(struct hl_device *hdev,
 		struct hl_debug_params *params)
 {
 	u64 base_reg;
-	struct hl_debug_params_spmu *input = params->input;
 	u64 *output;
 	u32 output_arr_len;
 	u32 events_num;
@@ -592,7 +591,7 @@ static int goya_config_spmu(struct hl_device *hdev,
 	base_reg = debug_spmu_regs[params->reg_idx] - CFG_BASE;
 
 	if (params->enable) {
-		input = params->input;
+		struct hl_debug_params_spmu *input = params->input;
 
 		if (!input)
 			return -EINVAL;
Signature · 1 line
2.43.0
maintainer Reviewed-by on v1 1/1 Applied
#1 lore raw
Quoted 28 lines · Colin Ian King

From: Colin Ian King <[email protected]>

The pointer input is assigned a value that is not read, it is being re-assigned again later with the same value. Resolve this by moving the declaration to input into the if block.

Cleans up clang scan build warning:
warning: Value stored to 'input' during its initialization is never read [deadcode.DeadStores]

---
  drivers/accel/habanalabs/goya/goya_coresight.c | 3 +--
  1 file changed, 1 insertion(+), 2 deletions(-)
drivers/accel/habanalabs/goya/goya_coresight.c +0 -1
index 41cae5fd843b..3827ea4c02f7 100644
@@ -576,7 +576,6 @@ static int goya_config_spmu(struct hl_device *hdev,
  		struct hl_debug_params *params)
  {
  	u64 base_reg;
-	struct hl_debug_params_spmu *input = params->input;
  	u64 *output;
  	u32 output_arr_len;
  	u32 events_num;

drivers/accel/habanalabs/goya/goya_coresight.c static int goya_config_spmu(struct hl_device *hdev, · line 597

Quoted 8 lines
drivers/accel/habanalabs/goya/goya_coresight.c +1 -1
@@ -592,7 +591,7 @@ static int goya_config_spmu(struct hl_device *hdev,
  	base_reg = debug_spmu_regs[params->reg_idx] - CFG_BASE;
 
  	if (params->enable) {
-		input = params->input;
+		struct hl_debug_params_spmu *input = params->input;
 
  		if (!input)
  			return -EINVAL;

Thanks for the patch.

Applied to -next.
Oded