mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] scsi: qedi: Add __printf to debug helpers and fix format strings
@ 2026-11-09 14:17 Adrián García Casado
  2026-11-09 22:50 ` kernel test robot
  2026-11-10  0:35 ` kernel test robot
  0 siblings, 2 replies; 3+ messages in thread
From: Adrián García Casado @ 2026-11-09 14:17 UTC (permalink / raw)
  To: Nilesh Javali, Manish Rangankar, Martin K . Petersen
  Cc: GR-ETH-Storage-Upstream, James E . J . Bottomley, linux-scsi,
	linux-kernel, Adrián García Casado

qedi_dbg_err(), qedi_dbg_warn(), qedi_dbg_notice(), and qedi_dbg_info()
format their variadic arguments via struct va_format and %pV, but unlike
their counterparts in qedf_dbg.h, they lack __printf() attributes in
qedi_dbg.h.

Add the missing __printf(4, 5) and __printf(5, 6) annotations to
qedi_dbg.h and fix the resulting -Wformat warnings exposed across
qedi_fw.c and qedi_main.c:

 - Use 0x%x instead of 0x%p for cqe->rqe_opaque (u16).
 - Use 0x%x instead of 0x%llx for pbl->address.hi and lo (__le32).
 - Use 0x%lx instead of 0x%x for qedi->qedi_err_flags (unsigned long).

Signed-off-by: Adrián García Casado <adriangarciacasado42@gmail.com>
---
 drivers/scsi/qedi/qedi_dbg.h  | 4 ++++
 drivers/scsi/qedi/qedi_fw.c   | 4 ++--
 drivers/scsi/qedi/qedi_main.c | 4 ++--
 3 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/scsi/qedi/qedi_dbg.h b/drivers/scsi/qedi/qedi_dbg.h
index 8649518658691..70acb55847f4f 100644
--- a/drivers/scsi/qedi/qedi_dbg.h
+++ b/drivers/scsi/qedi/qedi_dbg.h
@@ -78,12 +78,16 @@ struct qedi_dbg_ctx {
 		qedi_dbg_info(pdev, __func__, __LINE__, level, fmt,	\
 			      ## __VA_ARGS__)
 
+__printf(4, 5)
 void qedi_dbg_err(struct qedi_dbg_ctx *qedi, const char *func, u32 line,
 		  const char *fmt, ...);
+__printf(4, 5)
 void qedi_dbg_warn(struct qedi_dbg_ctx *qedi, const char *func, u32 line,
 		   const char *fmt, ...);
+__printf(4, 5)
 void qedi_dbg_notice(struct qedi_dbg_ctx *qedi, const char *func, u32 line,
 		     const char *fmt, ...);
+__printf(5, 6)
 void qedi_dbg_info(struct qedi_dbg_ctx *qedi, const char *func, u32 line,
 		   u32 info, const char *fmt, ...);
 
diff --git a/drivers/scsi/qedi/qedi_fw.c b/drivers/scsi/qedi/qedi_fw.c
index c8af10c326532..18df8b0138ef5 100644
--- a/drivers/scsi/qedi/qedi_fw.c
+++ b/drivers/scsi/qedi/qedi_fw.c
@@ -339,7 +339,7 @@ static void qedi_get_rq_bdq_buf(struct qedi_ctx *qedi,
 	}
 
 	QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_CONN,
-		  "rqe_opaque [0x%p], idx [%d]\n", cqe->rqe_opaque, idx);
+		  "rqe_opaque [0x%x], idx [%d]\n", cqe->rqe_opaque, idx);
 
 	QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_CONN,
 		  "unsol_cqe_type = %d\n", cqe->unsol_cqe_type);
@@ -378,7 +378,7 @@ static void qedi_put_rq_bdq_buf(struct qedi_ctx *qedi,
 	pbl->address.hi = cpu_to_le32(QEDI_U64_HI(qedi->bdq[idx].buf_dma));
 	pbl->address.lo = cpu_to_le32(QEDI_U64_LO(qedi->bdq[idx].buf_dma));
 	QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_CONN,
-		  "pbl [0x%p] pbl->address hi [0x%llx] lo [0x%llx] idx [%d]\n",
+		  "pbl [0x%p] pbl->address hi [0x%x] lo [0x%x] idx [%d]\n",
 		  pbl, pbl->address.hi, pbl->address.lo, idx);
 	pbl->opaque.iscsi_opaque.reserved_zero[0] = 0;
 	pbl->opaque.iscsi_opaque.reserved_zero[1] = 0;
diff --git a/drivers/scsi/qedi/qedi_main.c b/drivers/scsi/qedi/qedi_main.c
index f394fcbb97e7e..278dcea9f05e9 100644
--- a/drivers/scsi/qedi/qedi_main.c
+++ b/drivers/scsi/qedi/qedi_main.c
@@ -1128,7 +1128,7 @@ void qedi_schedule_hw_err_handler(void *dev,
 		qedi->qedi_err_flags = qedi_flags_override;
 
 	QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_INFO,
-		  "HW error handler scheduled, err=%d err_flags=0x%x\n",
+		  "HW error handler scheduled, err=%d err_flags=0x%lx\n",
 		  err_type, qedi->qedi_err_flags);
 
 	switch (err_type) {
@@ -1581,7 +1581,7 @@ static int qedi_alloc_bdq(struct qedi_ctx *qedi)
 		pbl->address.lo =
 				cpu_to_le32(QEDI_U64_LO(qedi->bdq[i].buf_dma));
 		QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_CONN,
-			  "pbl [0x%p] pbl->address hi [0x%llx] lo [0x%llx], idx [%d]\n",
+			  "pbl [0x%p] pbl->address hi [0x%x] lo [0x%x], idx [%d]\n",
 			  pbl, pbl->address.hi, pbl->address.lo, i);
 		pbl->opaque.iscsi_opaque.reserved_zero[0] = 0;
 		pbl->opaque.iscsi_opaque.reserved_zero[1] = 0;
-- 
2.39.5


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] scsi: qedi: Add __printf to debug helpers and fix format strings
  2026-11-09 14:17 [PATCH] scsi: qedi: Add __printf to debug helpers and fix format strings Adrián García Casado
@ 2026-11-09 22:50 ` kernel test robot
  2026-11-10  0:35 ` kernel test robot
  1 sibling, 0 replies; 3+ messages in thread
From: kernel test robot @ 2026-11-09 22:50 UTC (permalink / raw)
  To: Adrián García Casado, Nilesh Javali, Manish Rangankar,
	Martin K . Petersen
  Cc: llvm, oe-kbuild-all, GR-ETH-Storage-Upstream,
	James E . J . Bottomley, linux-scsi, linux-kernel,
	Adrián García Casado

Hi Adrián,

kernel test robot noticed the following build warnings:

[auto build test WARNING on jejb-scsi/for-next]
[also build test WARNING on mkp-scsi/for-next linus/master v7.4-rc2 next-20261109]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Adri-n-Garc-a-Casado/scsi-qedi-Add-__printf-to-debug-helpers-and-fix-format-strings/20261109-151738
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git for-next
patch link:    https://lore.kernel.org/r/20261109141738.1624579-1-adriangarciacasado42%40gmail.com
patch subject: [PATCH] scsi: qedi: Add __printf to debug helpers and fix format strings
config: i386-randconfig-1002-20261109 (https://download.01.org/0day-ci/archive/20261110/202611100645.IuoveOp3-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/20261110/202611100645.IuoveOp3-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/202611100645.IuoveOp3-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> drivers/scsi/qedi/qedi_main.c:1489:5: warning: format specifies type 'unsigned long long' but the argument has type 'dma_addr_t' (aka 'unsigned int') [-Wformat]
    1488 |                   "NVM BUF addr=0x%p dma=0x%llx.\n", qedi->iscsi_image,
         |                                            ~~~~
         |                                            %x
    1489 |                   qedi->nvm_buf_dma);
         |                   ^~~~~~~~~~~~~~~~~
   drivers/scsi/qedi/qedi_dbg.h:79:13: note: expanded from macro 'QEDI_INFO'
      78 |                 qedi_dbg_info(pdev, __func__, __LINE__, level, fmt,     \
         |                                                                ~~~
      79 |                               ## __VA_ARGS__)
         |                                  ^~~~~~~~~~~
   1 warning generated.


vim +1489 drivers/scsi/qedi/qedi_main.c

c57ec8fb7c0253 Nilesh Javali    2017-06-27  1477  
c57ec8fb7c0253 Nilesh Javali    2017-06-27  1478  static int qedi_alloc_nvm_iscsi_cfg(struct qedi_ctx *qedi)
c57ec8fb7c0253 Nilesh Javali    2017-06-27  1479  {
750afb08ca7131 Luis Chamberlain 2019-01-04  1480  	qedi->iscsi_image = dma_alloc_coherent(&qedi->pdev->dev,
872e192fab6438 Colin Ian King   2019-03-27  1481  					       sizeof(struct qedi_nvm_iscsi_image),
750afb08ca7131 Luis Chamberlain 2019-01-04  1482  					       &qedi->nvm_buf_dma, GFP_KERNEL);
c77a2fa3ff8f73 Nilesh Javali    2018-08-29  1483  	if (!qedi->iscsi_image) {
c57ec8fb7c0253 Nilesh Javali    2017-06-27  1484  		QEDI_ERR(&qedi->dbg_ctx, "Could not allocate NVM BUF.\n");
c57ec8fb7c0253 Nilesh Javali    2017-06-27  1485  		return -ENOMEM;
c57ec8fb7c0253 Nilesh Javali    2017-06-27  1486  	}
c57ec8fb7c0253 Nilesh Javali    2017-06-27  1487  	QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_INFO,
c77a2fa3ff8f73 Nilesh Javali    2018-08-29  1488  		  "NVM BUF addr=0x%p dma=0x%llx.\n", qedi->iscsi_image,
c57ec8fb7c0253 Nilesh Javali    2017-06-27 @1489  		  qedi->nvm_buf_dma);
c57ec8fb7c0253 Nilesh Javali    2017-06-27  1490  
c57ec8fb7c0253 Nilesh Javali    2017-06-27  1491  	return 0;
c57ec8fb7c0253 Nilesh Javali    2017-06-27  1492  }
c57ec8fb7c0253 Nilesh Javali    2017-06-27  1493  

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] scsi: qedi: Add __printf to debug helpers and fix format strings
  2026-11-09 14:17 [PATCH] scsi: qedi: Add __printf to debug helpers and fix format strings Adrián García Casado
  2026-11-09 22:50 ` kernel test robot
@ 2026-11-10  0:35 ` kernel test robot
  1 sibling, 0 replies; 3+ messages in thread
From: kernel test robot @ 2026-11-10  0:35 UTC (permalink / raw)
  To: Adrián García Casado, Nilesh Javali, Manish Rangankar,
	Martin K . Petersen
  Cc: oe-kbuild-all, GR-ETH-Storage-Upstream, James E . J . Bottomley,
	linux-scsi, linux-kernel, Adrián García Casado

Hi Adrián,

kernel test robot noticed the following build warnings:

[auto build test WARNING on jejb-scsi/for-next]
[also build test WARNING on mkp-scsi/for-next linus/master v7.4-rc2 next-20261109]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Adri-n-Garc-a-Casado/scsi-qedi-Add-__printf-to-debug-helpers-and-fix-format-strings/20261109-151738
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git for-next
patch link:    https://lore.kernel.org/r/20261109141738.1624579-1-adriangarciacasado42%40gmail.com
patch subject: [PATCH] scsi: qedi: Add __printf to debug helpers and fix format strings
config: csky-allmodconfig (https://download.01.org/0day-ci/archive/20261110/202611100825.B5pebp4Q-lkp@intel.com/config)
compiler: csky-linux-gcc (GCC) 16.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20261110/202611100825.B5pebp4Q-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/202611100825.B5pebp4Q-lkp@intel.com/

All warnings (new ones prefixed by >>):

   In file included from drivers/scsi/qedi/qedi.h:19,
                    from drivers/scsi/qedi/qedi_main.c:27:
   drivers/scsi/qedi/qedi_main.c: In function 'qedi_alloc_nvm_iscsi_cfg':
>> drivers/scsi/qedi/qedi_main.c:1488:19: warning: format '%llx' expects argument of type 'long long unsigned int', but argument 7 has type 'dma_addr_t' {aka 'unsigned int'} [-Wformat=]
    1488 |                   "NVM BUF addr=0x%p dma=0x%llx.\n", qedi->iscsi_image,
         |                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    1489 |                   qedi->nvm_buf_dma);
         |                   ~~~~~~~~~~~~~~~~~
         |                       |
         |                       dma_addr_t {aka unsigned int}
   drivers/scsi/qedi/qedi_dbg.h:78:64: note: in definition of macro 'QEDI_INFO'
      78 |                 qedi_dbg_info(pdev, __func__, __LINE__, level, fmt,     \
         |                                                                ^~~
   drivers/scsi/qedi/qedi_main.c:1488:47: note: format string is defined here
    1488 |                   "NVM BUF addr=0x%p dma=0x%llx.\n", qedi->iscsi_image,
         |                                            ~~~^
         |                                               |
         |                                               long long unsigned int
         |                                            %x
   drivers/scsi/qedi/qedi_main.c: In function 'qedi_alloc_global_queues':
   drivers/scsi/qedi/qedi_main.c:1754:1: error: could not split insn
    1754 | }
         | ^
   (insn 194 569 196 (set (reg:SI 3 a3 [orig:400 _253 ] [400])
           (xor:SI (reg:SI 2 a2 [orig:401 random_kmalloc_seed ] [401])
               (const:SI (plus:SI (symbol_ref:SI ("*.LANCHOR0") [flags 0x182])
                       (const_int 625 [0x271]))))) "include/linux/slab.h":762:52 288 {cskyv2_xorsi3}
        (expr_list:REG_DEAD (reg:SI 2 a2 [orig:401 random_kmalloc_seed ] [401])
           (nil)))
   during RTL pass: final
   drivers/scsi/qedi/qedi_main.c:1754:1: internal compiler error: in final_scan_insn_1, at final.cc:2823
   0x7f356d763d64 __libc_start_main
   	???:0
   ../lib/gcc/csky-linux/16.2.0/ -D __KERNEL__ -D KBUILD_EXTRA_WARN1 -D CSKYCPU_DEF_NAME="ck807f" -D MODULE -D KBUILD_BASENAME="qedi_main" -D KBUILD_MODNAME="qedi" -D __KBUILD_MODNAME=qedi -include include/linux/compiler-version.h -include include/linux/kconfig.h -include include/linux/compiler_types.h -MMD drivers/scsi/qedi/.qedi_main.o.d drivers/scsi/qedi/qedi_main.c -quiet -dumpdir drivers/scsi/qedi/ -dumpbase qedi_main.c -dumpbase-ext .c -mlittle-endian -mcpu=ck807 -mfloat-abi=soft -mdiv -mno-stack-size -O2 -Wall -Wextra -Werror=implicit-function-declaration -Werror=implicit-int -Werror=return-type -Werror=strict-prototypes -Wno-format-security -Wno-trigraphs -Wno-frame-address -Wno-address-of-packed-member -Wmissing-declarations -Wmissing-prototypes -Wframe-larger-than=1280 -Wno-main -Wno-type-limits -Wdangling-pointer=0 -Wvla-larger-than=1 -Wno-pointer-sign -Wcast-function-type -Wno-unterminated-string-initialization -Warray-bounds=0 -Wstringop-overflow=0 -Walloc-size-larger-than=18446744073709551615EiB -Wimplicit-fallthrough=5 -Werror=date-time -Werror=incompatible-pointer-types -Werror=designated-init -Wenum-conversion -Wunused -Wsuggest-attribute=format -Wmissing-include-dirs -Wunused-const-variable=2 -Wno-missing-field-initializers -Wno-shift-negative-value -Wno-maybe-uninitialized -Wno-sign-compare -Wno-unused-parameter -Wno-error=return-type -Wreturn-type -Wundef -std=gnu11 -p -fmacro-prefix-map== -fshort-wchar -fno-common -fno-PIE -fno-strict-aliasing -fms-extensions -fno-tree-vectorize -fno-delete-null-pointer-checks -fno-allow-store-data-races -fno-reorder-blocks -fno-ipa-cp-clone -fno-partial-inlining -fstack-protector-strong -ftrivial-auto-var-init=pattern -fzero-init-padding-bits=all -fno-stack-clash-protection -fdiagnostics-show-context=2 -fzero-call-used-regs=used-gpr -fno-inline-functions-called-once -fstrict-flex-arrays=3 -fno-strict-overflow -fstack-check=no -fconserve-stack -fno-builtin-wcslen -funsigned-char -falign-functions=64 -o -
   Please submit a full bug report, with preprocessed source (by using -freport-bug).
   Please include the complete backtrace with any bug report.
   See <https://gcc.gnu.org/bugs/> for instructions.


vim +1488 drivers/scsi/qedi/qedi_main.c

c57ec8fb7c02532 Nilesh Javali    2017-06-27  1477  
c57ec8fb7c02532 Nilesh Javali    2017-06-27  1478  static int qedi_alloc_nvm_iscsi_cfg(struct qedi_ctx *qedi)
c57ec8fb7c02532 Nilesh Javali    2017-06-27  1479  {
750afb08ca71310 Luis Chamberlain 2019-01-04  1480  	qedi->iscsi_image = dma_alloc_coherent(&qedi->pdev->dev,
872e192fab64388 Colin Ian King   2019-03-27  1481  					       sizeof(struct qedi_nvm_iscsi_image),
750afb08ca71310 Luis Chamberlain 2019-01-04  1482  					       &qedi->nvm_buf_dma, GFP_KERNEL);
c77a2fa3ff8f73d Nilesh Javali    2018-08-29  1483  	if (!qedi->iscsi_image) {
c57ec8fb7c02532 Nilesh Javali    2017-06-27  1484  		QEDI_ERR(&qedi->dbg_ctx, "Could not allocate NVM BUF.\n");
c57ec8fb7c02532 Nilesh Javali    2017-06-27  1485  		return -ENOMEM;
c57ec8fb7c02532 Nilesh Javali    2017-06-27  1486  	}
c57ec8fb7c02532 Nilesh Javali    2017-06-27  1487  	QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_INFO,
c77a2fa3ff8f73d Nilesh Javali    2018-08-29 @1488  		  "NVM BUF addr=0x%p dma=0x%llx.\n", qedi->iscsi_image,
c57ec8fb7c02532 Nilesh Javali    2017-06-27  1489  		  qedi->nvm_buf_dma);
c57ec8fb7c02532 Nilesh Javali    2017-06-27  1490  
c57ec8fb7c02532 Nilesh Javali    2017-06-27  1491  	return 0;
c57ec8fb7c02532 Nilesh Javali    2017-06-27  1492  }
c57ec8fb7c02532 Nilesh Javali    2017-06-27  1493  

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-11-10  0:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-09 14:17 [PATCH] scsi: qedi: Add __printf to debug helpers and fix format strings Adrián García Casado
2026-11-09 22:50 ` kernel test robot
2026-11-10  0:35 ` kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®