Skip to contentSkip to conversation

tracing histograms: remove redundant check on field->field

PATCH New Colin Ian King 1 participant 1 message Nov 7, 2024

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

PATCH 1/1 tracing histograms: remove redundant check on field->field

The check on field->field being true is handled as the first check on the cascaded if statement, so the later checks on field->field are redundant because this clause has already been handled. Since this later check is redundant, just remove it.

---
 kernel/trace/trace_events_hist.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
kernel/trace/trace_events_hist.c +1 -4
index c288b92fc4df..9c058aa8baf3 100644
@@ -1332,54 +1332,51 @@ static const char *hist_field_name(struct hist_field *field,
 
 	if (field->field)
 		field_name = field->field->name;
 	else if (field->flags & HIST_FIELD_FL_LOG2 ||
 		 field->flags & HIST_FIELD_FL_ALIAS ||
 		 field->flags & HIST_FIELD_FL_BUCKET)
 		field_name = hist_field_name(field->operands[0], ++level);
 	else if (field->flags & HIST_FIELD_FL_CPU)
 		field_name = "common_cpu";
 	else if (field->flags & HIST_FIELD_FL_EXPR ||
 		 field->flags & HIST_FIELD_FL_VAR_REF) {
 		if (field->system) {
 			static char full_name[MAX_FILTER_STR_VAL];
 
 			strcat(full_name, field->system);
 			strcat(full_name, ".");
 			strcat(full_name, field->event_name);
 			strcat(full_name, ".");
 			strcat(full_name, field->name);
 			field_name = full_name;
 		} else
 			field_name = field->name;
 	} else if (field->flags & HIST_FIELD_FL_TIMESTAMP)
 		field_name = "common_timestamp";
 	else if (field->flags & HIST_FIELD_FL_STACKTRACE) {
-		if (field->field)
-			field_name = field->field->name;
-		else
-			field_name = "common_stacktrace";
+		field_name = "common_stacktrace";
 	} else if (field->flags & HIST_FIELD_FL_HITCOUNT)
 		field_name = "hitcount";
 
 	if (field_name == NULL)
 		field_name = "";
 
 	return field_name;
 }
 
 static enum hist_field_fn select_value_fn(int field_size, int field_is_signed)
 {
 	switch (field_size) {
 	case 8:
 		if (field_is_signed)
 			return HIST_FIELD_FN_S64;
 		else
 			return HIST_FIELD_FN_U64;
 	case 4:
 		if (field_is_signed)
 			return HIST_FIELD_FN_S32;
 		else
 			return HIST_FIELD_FN_U32;
 	case 2:
 		if (field_is_signed)
 			return HIST_FIELD_FN_S16;
Signature · 1 line
2.39.5