perf report: Fix -F for branch & mem modes

perf report fails to add valid additional fields with -F when
used with branch or mem modes. Fix it.

Before patch:

  $ perf record -b
  $ perf report -b -F +srcline_from --stdio
  Invalid --fields key: `srcline_from'

After patch:

  $ perf report -b -F +srcline_from --stdio
  # Samples: 8K of event 'cycles'
  # Event count (approx.): 8784

Committer notes:

There was an inversion: when looking at branch stack dimensions (keys)
it was checking if the sort mode was 'mem', not 'branch'.

Fixes: aa6b3c99236b ("perf report: Make -F more strict like -s")
Reported-by: Athira Jajeev <>
Signed-off-by: Ravi Bangoria <>
Reviewed-by: Athira Jajeev <>
Tested-by: Arnaldo Carvalho de Melo <>
Tested-by: Athira Jajeev <>
Cc: Jiri Olsa <>
Cc: Kan Liang <>
Cc: Namhyung Kim <>
Signed-off-by: Arnaldo Carvalho de Melo <>
1 file changed