coresight: Fix uninitialised variable use in coresight_disable
authorSuzuki K Poulose <suzuki.poulose@arm.com>
Mon, 23 Jan 2023 16:08:45 +0000 (16:08 +0000)
committerSuzuki K Poulose <suzuki.poulose@arm.com>
Tue, 24 Jan 2023 10:36:53 +0000 (10:36 +0000)
commit0c507af711df7e7b114fa6ec188e6d860cae29c1
tree6c6dd6ab3abc790628362e2936c0e677561859d7
parent705159622cb8d7896a0c052deebd91e616da9bbf
coresight: Fix uninitialised variable use in coresight_disable

Kernel test robot reports:

 drivers/hwtracing/coresight/coresight-core.c:1176:7: warning: variable
 'hash' is used uninitialized whenever switch case is taken
 [-Wsometimes-uninitialized]

case CORESIGHT_DEV_SUBTYPE_SOURCE_PROC:
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 drivers/hwtracing/coresight/coresight-core.c:1195:24: note: uninitialized
 use occurs here
idr_remove(&path_idr, hash);
                      ^~~~
Fix this by moving the usage of the hash variable to where it actually
should have been.

Cc: Mao Jinlong <quic_jinlmao@quicinc.com>
Link: https://lkml.kernel.org/r/202301211339.9mU0dccO-lkp@intel.com
Reported-by: kernel test robot <lkp@intel.com>
Reviewed-by: James Clark <james.clark@arm.com>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Link: https://lkml.kernel.org/r/20230123164700.1074064-1-suzuki.poulose@arm.com
drivers/hwtracing/coresight/coresight-core.c