perf pmu: Fix check for unset alias->unit array 84/292584/1
authorArnaldo Carvalho de Melo <acme@redhat.com>
Wed, 15 Feb 2017 13:06:20 +0000 (10:06 -0300)
committerSeung-Woo Kim <sw0312.kim@samsung.com>
Tue, 9 May 2023 09:23:42 +0000 (18:23 +0900)
commite58ca0a5b7f0b0f192c2e495933731f6f07e5b86
treead92079dd73515e741574629ec5eea4c56beffa3
parent02ca6eb5cbc1dbadba0659a7eb859ea88ede9db1
perf pmu: Fix check for unset alias->unit array

The alias->unit field is an array, so to check that it is not set we
should see if it is an empty string, i.e. alias->unit[0], instead of
checking alias->unit != NULL, as this will _always_ evaluate to 'true'.

Pointed out by clang.

Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/r/20170214182435.GD4458@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
[sw0312.kim: backport upstream commit b30a7d1fc96d to resolve gcc-12 build issue]
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Change-Id: Ia18ceb8d7176ab8fd69ce5c284064e88783553e2
tools/perf/util/pmu.c