drivers/cxl/port.c:88 cxl_port_perf_data_calculate() error: we previously assumed 'cxl_root->ops' could be null (see line 88)
PATCH 24/30 drivers/cxl/port.c:88 cxl_port_perf_data_calculate() error: we previously assumed 'cxl_root->ops' could be null (see line 88)
tree: https://git.kernel.org/pub/scm/linux/kernel/git/djiang/linux.git cxl-qtg head: fd35584ec7147f575dcdc65239bc8ac7fe340ab4 commit: 6f49d1fab777d2585dae7c6ab7e228f540f190d4 [24/30] cxl: Compute the entire CXL path latency and bandwidth data config: i386-randconfig-m021 (https://download.01.org/0day-ci/archive/20230512/[email protected]/config) compiler: gcc-11 (Debian 11.3.0-12) 11.3.0
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <[email protected]> | Reported-by: Dan Carpenter <[email protected]> | Link: https://lore.kernel.org/r/[email protected]/
smatch warnings:drivers/cxl/port.c:88 cxl_port_perf_data_calculate() error: we previously assumed 'cxl_root->ops' could be null (see line 88)
vim +88 drivers/cxl/port.c
6f49d1fab777d2 Dave Jiang 2022-12-05 70 static int cxl_port_perf_data_calculate(struct cxl_port *port,
6f49d1fab777d2 Dave Jiang 2022-12-05 71 struct list_head *dsmas_list)
6f49d1fab777d2 Dave Jiang 2022-12-05 72 {
6f49d1fab777d2 Dave Jiang 2022-12-05 73 struct access_coordinate c;
6f49d1fab777d2 Dave Jiang 2022-12-05 74 struct qtg_dsm_input input;
6f49d1fab777d2 Dave Jiang 2022-12-05 75 struct cxl_port *root_port;
6f49d1fab777d2 Dave Jiang 2022-12-05 76 struct cxl_root *cxl_root;
6f49d1fab777d2 Dave Jiang 2022-12-05 77 struct dsmas_entry *dent;
6f49d1fab777d2 Dave Jiang 2022-12-05 78 int rc, qos_class;
6f49d1fab777d2 Dave Jiang 2022-12-05 79
6f49d1fab777d2 Dave Jiang 2022-12-05 80 rc = cxl_endpoint_get_perf_coordinates(port, &c);
6f49d1fab777d2 Dave Jiang 2022-12-05 81 if (rc) {
6f49d1fab777d2 Dave Jiang 2022-12-05 82 dev_dbg(&port->dev, "Failed to retrieve perf coordinates.\n");
6f49d1fab777d2 Dave Jiang 2022-12-05 83 return rc;
6f49d1fab777d2 Dave Jiang 2022-12-05 84 }
6f49d1fab777d2 Dave Jiang 2022-12-05 85
6f49d1fab777d2 Dave Jiang 2022-12-05 86 root_port = find_cxl_root(port);
6f49d1fab777d2 Dave Jiang 2022-12-05 87 cxl_root = to_cxl_root(root_port);6f49d1fab777d2 Dave Jiang 2022-12-05 @88 if (!cxl_root->ops && !cxl_root->ops->get_qos_class)
&& vs ||.
6f49d1fab777d2 Dave Jiang 2022-12-05 89 return -EOPNOTSUPP;
6f49d1fab777d2 Dave Jiang 2022-12-05 90
6f49d1fab777d2 Dave Jiang 2022-12-05 91 list_for_each_entry(dent, dsmas_list, list) {
6f49d1fab777d2 Dave Jiang 2022-12-05 92 dent->coord.read_latency = dent->coord.read_latency +
6f49d1fab777d2 Dave Jiang 2022-12-05 93 c.read_latency;
6f49d1fab777d2 Dave Jiang 2022-12-05 94 dent->coord.write_latency = dent->coord.write_latency +
6f49d1fab777d2 Dave Jiang 2022-12-05 95 c.write_latency;
6f49d1fab777d2 Dave Jiang 2022-12-05 96 dent->coord.read_bandwidth = min_t(int, c.read_bandwidth,
6f49d1fab777d2 Dave Jiang 2022-12-05 97 dent->coord.read_bandwidth);
6f49d1fab777d2 Dave Jiang 2022-12-05 98 dent->coord.write_bandwidth = min_t(int, c.write_bandwidth,
6f49d1fab777d2 Dave Jiang 2022-12-05 99 dent->coord.write_bandwidth);
6f49d1fab777d2 Dave Jiang 2022-12-05 100
6f49d1fab777d2 Dave Jiang 2022-12-05 101 input.rd_lat = cpu_to_le32(dent->coord.read_latency);
6f49d1fab777d2 Dave Jiang 2022-12-05 102 input.wr_lat = cpu_to_le32(dent->coord.write_latency);
6f49d1fab777d2 Dave Jiang 2022-12-05 103 input.rd_bw = cpu_to_le32(dent->coord.read_bandwidth);
6f49d1fab777d2 Dave Jiang 2022-12-05 104 input.wr_bw = cpu_to_le32(dent->coord.write_bandwidth);
6f49d1fab777d2 Dave Jiang 2022-12-05 105
6f49d1fab777d2 Dave Jiang 2022-12-05 106 qos_class = cxl_root->ops->get_qos_class(root_port, &input);
6f49d1fab777d2 Dave Jiang 2022-12-05 107 if (qos_class < 0)
6f49d1fab777d2 Dave Jiang 2022-12-05 108 continue;
6f49d1fab777d2 Dave Jiang 2022-12-05 109
6f49d1fab777d2 Dave Jiang 2022-12-05 110 dent->qos_class = qos_class;
6f49d1fab777d2 Dave Jiang 2022-12-05 111 }
6f49d1fab777d2 Dave Jiang 2022-12-05 112
6f49d1fab777d2 Dave Jiang 2022-12-05 113 return 0;
6f49d1fab777d2 Dave Jiang 2022-12-05 114 }Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests