From: kernel test robot <lkp@intel.com>
To: Manish Rangankar <mrangankar@marvell.com>
Cc: llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev,
0day robot <lkp@intel.com>, Nilesh Javali <njavali@marvell.com>,
Hannes Reinecke <hare@kernel.org>
Subject: drivers/scsi/qla2xxx/qla_sup.c:319:28: warning: variable 'chunk_count' set but not used
Date: Tue, 14 Jul 2026 15:58:59 +0200 [thread overview]
Message-ID: <202607141520.k9T31Dpp-lkp@intel.com> (raw)
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/202607141520.k9T31Dpp-lkp@intel.com/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/202607141520.k9T31Dpp-lkp@intel.com/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 <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202607141520.k9T31Dpp-lkp@intel.com/
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
reply other threads:[~2026-07-14 13:59 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=202607141520.k9T31Dpp-lkp@intel.com \
--to=lkp@intel.com \
--cc=hare@kernel.org \
--cc=llvm@lists.linux.dev \
--cc=mrangankar@marvell.com \
--cc=njavali@marvell.com \
--cc=oe-kbuild-all@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox