Message ID | 20230123164700.1074064-1-suzuki.poulose@arm.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | coresight: Fix uninitialised variable use in coresight_disable | expand |
On 23/01/2023 16:47, Suzuki K Poulose wrote: > 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> > Reported-by: kernel test robot <lkp@intel.com> > Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com> Reviewed-by: James Clark <james.clark@arm.com> > --- > drivers/hwtracing/coresight/coresight-core.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/hwtracing/coresight/coresight-core.c b/drivers/hwtracing/coresight/coresight-core.c > index a798008ac56e..d3bf82c0de1d 100644 > --- a/drivers/hwtracing/coresight/coresight-core.c > +++ b/drivers/hwtracing/coresight/coresight-core.c > @@ -1189,13 +1189,13 @@ void coresight_disable(struct coresight_device *csdev) > pr_err("Path is not found for %s\n", dev_name(&csdev->dev)); > goto out; > } > + idr_remove(&path_idr, hash); > break; > default: > /* We can't be here */ > break; > } > > - idr_remove(&path_idr, hash); > coresight_disable_path(path); > coresight_release_path(path); >
On 24/01/2023 10:35, James Clark wrote: > > > On 23/01/2023 16:47, Suzuki K Poulose wrote: >> 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> >> Reported-by: kernel test robot <lkp@intel.com> >> Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com> > > Reviewed-by: James Clark <james.clark@arm.com> > Thanks James, I have now pushed this to next https://git.kernel.org/coresight/c/0c507af711df7e7b114f
diff --git a/drivers/hwtracing/coresight/coresight-core.c b/drivers/hwtracing/coresight/coresight-core.c index a798008ac56e..d3bf82c0de1d 100644 --- a/drivers/hwtracing/coresight/coresight-core.c +++ b/drivers/hwtracing/coresight/coresight-core.c @@ -1189,13 +1189,13 @@ void coresight_disable(struct coresight_device *csdev) pr_err("Path is not found for %s\n", dev_name(&csdev->dev)); goto out; } + idr_remove(&path_idr, hash); break; default: /* We can't be here */ break; } - idr_remove(&path_idr, hash); coresight_disable_path(path); coresight_release_path(path);
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> Reported-by: kernel test robot <lkp@intel.com> Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com> --- drivers/hwtracing/coresight/coresight-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)