drivers/scsi/qla2xxx/qla_sup.c:319:28: warning: variable 'chunk_count' set but not used
kernel test robot <[email protected]>
| Newsgroups | dev.linux.lists.llvm,dev.linux.lists.oe-kbuild-all |
|---|---|
| Message-ID | <[email protected]> |
tree: https://github.com/intel-lab-lkp/linux/commits/Nilesh-Javali/scsi-qla2xxx-Add-29xx-series-PCI-device-ID-support/20260714-180455 head: a91be341107d322b5c157a8eb685f7d8d4d9277b commit: 16cd00c766b785eeb125dbd4f768b64ad26ce4c3 scsi: qla2xxx: Add flash read/write interface for 29xx date: 4 hours ago config: x86_64-kexec (https://download.01.org/0day-ci/archive/20260714/[email protected]/config) compiler: clang version 22.1.8 (https://github.com/llvm/llvm-project ca7933e47d3a3451d81e72ac174dcb5aa28b59d1) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260714/[email protected]/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <[email protected]> | Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/ All warnings (new ones prefixed by >>): >> drivers/scsi/qla2xxx/qla_sup.c:319:28: warning: variable 'chunk_count' set but not used [-Wunused-but-set-variable] 319 | uint16_t chunk_index = 0, chunk_count = 0; | ^ drivers/scsi/qla2xxx/qla_sup.c:447:28: warning: variable 'chunk_count' set but not used [-Wunused-but-set-variable] 447 | uint16_t chunk_index = 0, chunk_count = 0; | ^ 2 warnings generated. vim +/chunk_count +319 drivers/scsi/qla2xxx/qla_sup.c 290 291 /** 292 * qla29xx_write_optrom_data - Write data to the optrom for QLA29xx adapters. 293 * @vha: Pointer to SCSI QLogic host structure. 294 * @reg_code: Region code to write to. 295 * @opts: Options for the write operation. 296 * @buf: Buffer containing the data to write. 297 * @offset: Offset within the region to start writing. 298 * @length: Length of data to write. 299 * 300 * This function writes data to the specified optrom region for QLA29xx adapters. 301 * 302 * Returns 0 on success or a negative error code on failure. 303 */ 304 int 305 qla29xx_write_optrom_data(struct scsi_qla_host *vha, uint16_t reg_code, 306 uint16_t opts, void *buf, uint32_t offset, 307 uint32_t length) 308 { 309 struct qla_hw_data *ha = vha->hw; 310 struct qla_flt_region_data region; 311 dma_addr_t optrom_dma; 312 uint32_t faddr, left, burst; 313 uint32_t img_len, seg_dlen; 314 uint32_t region_len, region_dlen; 315 void *optrom; 316 uint8_t *pbuf; 317 int rval = -EINVAL; 318 uint16_t total_segments, segment_index = 0; > 319 uint16_t chunk_index = 0, chunk_count = 0; 320 321 memset(®ion, 0, sizeof(region)); 322 323 optrom = dma_alloc_coherent(&ha->pdev->dev, OPTROM_BURST_SIZE, 324 &optrom_dma, GFP_KERNEL); 325 if (!optrom) { 326 ql_log(ql_log_warn, vha, 0x0090, 327 "Unable to allocate memory for optrom burst read (%x KB).\n", 328 OPTROM_BURST_SIZE / 1024); 329 return -ENOMEM; 330 } 331 332 if (ha->flags.valid_flt && length == 0) { 333 /* Get image length and segment length from FLT */ 334 rval = qla29xx_get_flash_region(vha, reg_code, ®ion); 335 if (rval != QLA_SUCCESS) { 336 ql_log(ql_log_warn, vha, 0x0092, 337 "Invalid address %x - not a region start address\n", 338 reg_code); 339 goto free_buf; 340 } 341 img_len = le32_to_cpu(region.image_length); 342 } else { 343 img_len = length; 344 } 345 346 seg_dlen = ha->flt_segment_length >> 2; 347 region_len = (length > 0) ? length : img_len; 348 region_dlen = (region_len >> 2); 349 total_segments = (region_dlen + seg_dlen - 1) / seg_dlen; 350 351 faddr = offset >> 2; 352 left = region_dlen; 353 burst = OPTROM_BURST_DWORDS; 354 pbuf = buf; 355 356 while (region_dlen > 0) { 357 uint32_t segment_size, total_chunks; 358 uint16_t options = 0; 359 360 segment_size = (region_dlen > seg_dlen) ? seg_dlen : region_dlen; 361 total_chunks = (segment_size + OPTROM_BURST_DWORDS - 1) / 362 OPTROM_BURST_DWORDS; 363 364 burst = OPTROM_BURST_DWORDS; 365 if (burst > left) 366 burst = left; 367 if (burst > segment_size - chunk_index * OPTROM_BURST_DWORDS) 368 burst = segment_size - chunk_index * OPTROM_BURST_DWORDS; 369 370 set_segment_bits(&options, segment_index, total_segments); 371 set_chunk_bits(&options, chunk_index, total_chunks); 372 373 /* flash block write operations */ 374 SET_FW_BIT(options, BIT_6); 375 CLEAR_FW_BIT(options, BIT_9); 376 377 check_and_set_mbc_bits(opts, options, BIT_15, BIT_15); 378 check_and_set_mbc_bits(opts, options, BIT_7, BIT_7); 379 380 if (segment_index == total_segments - 1 && 381 chunk_index == total_chunks - 1) 382 check_and_set_mbc_bits(opts, options, BIT_8, BIT_8); 383 384 memcpy(optrom, pbuf, burst * 4); 385 386 /* faddr is offset relative to region code */ 387 rval = qla29xx_flash_block_write(vha, optrom_dma, 388 faddr, burst, reg_code, options); 389 if (rval) { 390 ql_log(ql_log_warn, vha, 0x0095, 391 "Unable to burst-write optrom segment (%x/%x/%llx).\n", 392 rval, faddr, (unsigned long long)optrom_dma); 393 394 dma_free_coherent(&ha->pdev->dev, OPTROM_BURST_SIZE, 395 optrom, optrom_dma); 396 goto exit_write; 397 } 398 399 left -= burst; 400 faddr += burst; 401 pbuf += burst * 4; 402 chunk_index++; 403 chunk_count++; 404 if (chunk_index >= total_chunks) { 405 chunk_index = 0; 406 segment_index++; 407 region_dlen -= segment_size; 408 } 409 } 410 411 free_buf: 412 dma_free_coherent(&ha->pdev->dev, OPTROM_BURST_SIZE, optrom, 413 optrom_dma); 414 return rval; 415 416 exit_write: 417 return rval; 418 } 419 -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki