On Wed, Jan 11, 2023 at 12:06:27PM +0000, Chengwen Feng wrote: > When telemetry callback didn't set dict and return a non-negative
I'd suggest rewording the "didn't set dict", since it's not required that a telemetry callback do anything with dictionaries. I'd suggest: "When a telemetry callback doesn't initialize the telemetry data structure and returns a non-negative number..." > number, the telemetry will repeat to display the last result. This > patch zero the dict to avoid the problem. s/zero the dict/zero the data-structure/ > > Fixes: 6dd571fd07c3 ("telemetry: introduce new functionality") > Cc: sta...@dpdk.org > > Signed-off-by: Chengwen Feng <fengcheng...@huawei.com> > --- Reviewed-by: Bruce Richardson <bruce.richard...@intel.com> > lib/telemetry/telemetry.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/lib/telemetry/telemetry.c b/lib/telemetry/telemetry.c > index 8fbb4f3060..7b905355cd 100644 > --- a/lib/telemetry/telemetry.c > +++ b/lib/telemetry/telemetry.c > @@ -333,7 +333,7 @@ output_json(const char *cmd, const struct rte_tel_data > *d, int s) > static void > perform_command(telemetry_cb fn, const char *cmd, const char *param, int s) > { > - struct rte_tel_data data; > + struct rte_tel_data data = {0}; > > int ret = fn(cmd, param, &data); > if (ret < 0) { > -- > 2.17.1 >