Messages in this thread | | | Date | Tue, 28 Sep 2021 10:13:50 +0800 | From | kernel test robot <> | Subject | drivers/hwtracing/coresight/coresight-etm-perf.c:438:6: warning: variable 'event_data' is used uninitialized whenever 'if' condition is true |
| |
tree: https://github.com/0day-ci/linux/commits/James-Clark/coresight-Don-t-immediately-close-events-that-are-run-on-invalid-CPU-sink-combos/20210922-124616 head: 2e3df445ee8fbee18a1670a46b6f0296add37c17 commit: 2e3df445ee8fbee18a1670a46b6f0296add37c17 coresight: Don't immediately close events that are run on invalid CPU/sink combos date: 6 days ago config: arm64-randconfig-r013-20210927 (attached as .config) compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project dc6e8dfdfe7efecfda318d43a06fae18b40eb498) reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # install arm64 cross compiling tool for clang build # apt-get install binutils-aarch64-linux-gnu # https://github.com/0day-ci/linux/commit/2e3df445ee8fbee18a1670a46b6f0296add37c17 git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review James-Clark/coresight-Don-t-immediately-close-events-that-are-run-on-invalid-CPU-sink-combos/20210922-124616 git checkout 2e3df445ee8fbee18a1670a46b6f0296add37c17 # save the attached .config to linux build tree COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=arm64
If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
>> drivers/hwtracing/coresight/coresight-etm-perf.c:438:6: warning: variable 'event_data' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized] if (WARN_ON(ctxt->event_data)) ^~~~~~~~~~~~~~~~~~~~~~~~~ include/asm-generic/bug.h:120:28: note: expanded from macro 'WARN_ON' #define WARN_ON(condition) ({ \ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/hwtracing/coresight/coresight-etm-perf.c:482:21: note: uninitialized use occurs here ctxt->event_data = event_data; ^~~~~~~~~~ drivers/hwtracing/coresight/coresight-etm-perf.c:438:2: note: remove the 'if' if its condition is always false if (WARN_ON(ctxt->event_data)) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/hwtracing/coresight/coresight-etm-perf.c:434:6: warning: variable 'event_data' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized] if (!csdev) ^~~~~~ drivers/hwtracing/coresight/coresight-etm-perf.c:482:21: note: uninitialized use occurs here ctxt->event_data = event_data; ^~~~~~~~~~ drivers/hwtracing/coresight/coresight-etm-perf.c:434:2: note: remove the 'if' if its condition is always false if (!csdev) ^~~~~~~~~~~ drivers/hwtracing/coresight/coresight-etm-perf.c:428:35: note: initialize the variable 'event_data' to silence this warning struct etm_event_data *event_data; ^ = NULL 2 warnings generated.
vim +438 drivers/hwtracing/coresight/coresight-etm-perf.c
0bcbf2e30ff2271 Mathieu Poirier 2016-02-17 424 0bcbf2e30ff2271 Mathieu Poirier 2016-02-17 425 static void etm_event_start(struct perf_event *event, int flags) 0bcbf2e30ff2271 Mathieu Poirier 2016-02-17 426 { 0bcbf2e30ff2271 Mathieu Poirier 2016-02-17 427 int cpu = smp_processor_id(); 0bcbf2e30ff2271 Mathieu Poirier 2016-02-17 428 struct etm_event_data *event_data; 549452b73e6bf75 Suzuki K Poulose 2021-04-05 429 struct etm_ctxt *ctxt = this_cpu_ptr(&etm_ctxt); 549452b73e6bf75 Suzuki K Poulose 2021-04-05 430 struct perf_output_handle *handle = &ctxt->handle; 0bcbf2e30ff2271 Mathieu Poirier 2016-02-17 431 struct coresight_device *sink, *csdev = per_cpu(csdev_src, cpu); 5ecabe4a76e8cdb Suzuki K Poulose 2018-09-20 432 struct list_head *path; 0bcbf2e30ff2271 Mathieu Poirier 2016-02-17 433 0bcbf2e30ff2271 Mathieu Poirier 2016-02-17 434 if (!csdev) 0bcbf2e30ff2271 Mathieu Poirier 2016-02-17 435 goto fail; 0bcbf2e30ff2271 Mathieu Poirier 2016-02-17 436 549452b73e6bf75 Suzuki K Poulose 2021-04-05 437 /* Have we messed up our tracking ? */ 549452b73e6bf75 Suzuki K Poulose 2021-04-05 @438 if (WARN_ON(ctxt->event_data)) 549452b73e6bf75 Suzuki K Poulose 2021-04-05 439 goto fail; 549452b73e6bf75 Suzuki K Poulose 2021-04-05 440 0bcbf2e30ff2271 Mathieu Poirier 2016-02-17 441 /* 0bcbf2e30ff2271 Mathieu Poirier 2016-02-17 442 * Deal with the ring buffer API and get a handle on the 0bcbf2e30ff2271 Mathieu Poirier 2016-02-17 443 * session's information. 0bcbf2e30ff2271 Mathieu Poirier 2016-02-17 444 */ 0bcbf2e30ff2271 Mathieu Poirier 2016-02-17 445 event_data = perf_aux_output_begin(handle, event); 0bcbf2e30ff2271 Mathieu Poirier 2016-02-17 446 if (!event_data) 0bcbf2e30ff2271 Mathieu Poirier 2016-02-17 447 goto fail; 0bcbf2e30ff2271 Mathieu Poirier 2016-02-17 448 859d510e58dac94 Suzuki K Poulose 2020-09-16 449 /* 859d510e58dac94 Suzuki K Poulose 2020-09-16 450 * Check if this ETM is allowed to trace, as decided 859d510e58dac94 Suzuki K Poulose 2020-09-16 451 * at etm_setup_aux(). This could be due to an unreachable 859d510e58dac94 Suzuki K Poulose 2020-09-16 452 * sink from this ETM. We can't do much in this case if 859d510e58dac94 Suzuki K Poulose 2020-09-16 453 * the sink was specified or hinted to the driver. For 859d510e58dac94 Suzuki K Poulose 2020-09-16 454 * now, simply don't record anything on this ETM. 2e3df445ee8fbee James Clark 2021-09-21 455 * 2e3df445ee8fbee James Clark 2021-09-21 456 * As such we pretend that everything is fine, and let 2e3df445ee8fbee James Clark 2021-09-21 457 * it continue without actually tracing. The event could 2e3df445ee8fbee James Clark 2021-09-21 458 * continue tracing when it moves to a CPU where it is 2e3df445ee8fbee James Clark 2021-09-21 459 * reachable to a sink. 859d510e58dac94 Suzuki K Poulose 2020-09-16 460 */ 859d510e58dac94 Suzuki K Poulose 2020-09-16 461 if (!cpumask_test_cpu(cpu, &event_data->mask)) 2e3df445ee8fbee James Clark 2021-09-21 462 goto out; 859d510e58dac94 Suzuki K Poulose 2020-09-16 463 5ecabe4a76e8cdb Suzuki K Poulose 2018-09-20 464 path = etm_event_cpu_path(event_data, cpu); 0bcbf2e30ff2271 Mathieu Poirier 2016-02-17 465 /* We need a sink, no need to continue without one */ 5ecabe4a76e8cdb Suzuki K Poulose 2018-09-20 466 sink = coresight_get_sink(path); 3d6e89357583921 Suzuki K Poulose 2018-09-20 467 if (WARN_ON_ONCE(!sink)) 0bcbf2e30ff2271 Mathieu Poirier 2016-02-17 468 goto fail_end_stop; 0bcbf2e30ff2271 Mathieu Poirier 2016-02-17 469 0bcbf2e30ff2271 Mathieu Poirier 2016-02-17 470 /* Nothing will happen without a path */ 3d6e89357583921 Suzuki K Poulose 2018-09-20 471 if (coresight_enable_path(path, CS_MODE_PERF, handle)) 0bcbf2e30ff2271 Mathieu Poirier 2016-02-17 472 goto fail_end_stop; 0bcbf2e30ff2271 Mathieu Poirier 2016-02-17 473 0bcbf2e30ff2271 Mathieu Poirier 2016-02-17 474 /* Finally enable the tracer */ 68905d73df5d51b Mathieu Poirier 2016-08-25 475 if (source_ops(csdev)->enable(csdev, event, CS_MODE_PERF)) 4f8ef21007531c3 Suzuki K Poulose 2018-09-20 476 goto fail_disable_path; 0bcbf2e30ff2271 Mathieu Poirier 2016-02-17 477 2e3df445ee8fbee James Clark 2021-09-21 478 out: 2e3df445ee8fbee James Clark 2021-09-21 479 /* Tell the perf core the event is alive */ 2e3df445ee8fbee James Clark 2021-09-21 480 event->hw.state = 0; 549452b73e6bf75 Suzuki K Poulose 2021-04-05 481 /* Save the event_data for this ETM */ 549452b73e6bf75 Suzuki K Poulose 2021-04-05 482 ctxt->event_data = event_data; 0bcbf2e30ff2271 Mathieu Poirier 2016-02-17 483 return; 0bcbf2e30ff2271 Mathieu Poirier 2016-02-17 484 4f8ef21007531c3 Suzuki K Poulose 2018-09-20 485 fail_disable_path: 4f8ef21007531c3 Suzuki K Poulose 2018-09-20 486 coresight_disable_path(path); 0bcbf2e30ff2271 Mathieu Poirier 2016-02-17 487 fail_end_stop: f4c0b0aa58d9b7e Will Deacon 2017-02-20 488 perf_aux_output_flag(handle, PERF_AUX_FLAG_TRUNCATED); f4c0b0aa58d9b7e Will Deacon 2017-02-20 489 perf_aux_output_end(handle, 0); 0bcbf2e30ff2271 Mathieu Poirier 2016-02-17 490 fail: 0bcbf2e30ff2271 Mathieu Poirier 2016-02-17 491 event->hw.state = PERF_HES_STOPPED; 0bcbf2e30ff2271 Mathieu Poirier 2016-02-17 492 goto out; 0bcbf2e30ff2271 Mathieu Poirier 2016-02-17 493 } 0bcbf2e30ff2271 Mathieu Poirier 2016-02-17 494
--- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org [unhandled content-type:application/gzip] | |