From 228b239a8a33e358723dcc40b52624600108a302 Mon Sep 17 00:00:00 2001 From: Kelvin Cao Date: Fri, 8 Sep 2023 05:33:44 -0700 Subject: [PATCH] cli: Fix a 'events -r' issue It was observed that the option '-r' doesn't take effect unless the option '-a' is specified at the same time. The option '-a' should only control the showing of events and has no control for clearing. Fix this to allow option '-r' clear all events no matter if option '-a' is specified. --- cli/main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cli/main.c b/cli/main.c index 5076d38f..78d3401e 100644 --- a/cli/main.c +++ b/cli/main.c @@ -796,9 +796,6 @@ static int get_events(struct switchtec_dev *dev, break; } - if (!show_all && e->partition != local_part) - continue; - if (clear_all || event_id & (1 << e->eid)) flags = SWITCHTEC_EVT_FLAG_CLEAR; else @@ -810,6 +807,9 @@ static int get_events(struct switchtec_dev *dev, return -1; } + if (!show_all && e->partition != local_part) + continue; + e->count = ret; e++; if (e - elist > elist_len)