Message ID | 20230626091541.1064-1-youkangren@vivo.com |
---|---|
State | New |
Headers | show |
Series | crypto: qat - Replace the if statement with min() | expand |
Hi You, kernel test robot noticed the following build warnings: [auto build test WARNING on herbert-cryptodev-2.6/master] [also build test WARNING on herbert-crypto-2.6/master linus/master v6.4 next-20230626] [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/You-Kangren/crypto-qat-Replace-the-if-statement-with-min/20230626-172132 base: https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git master patch link: https://lore.kernel.org/r/20230626091541.1064-1-youkangren%40vivo.com patch subject: [PATCH] crypto: qat - Replace the if statement with min() config: i386-randconfig-i001-20230626 (https://download.01.org/0day-ci/archive/20230626/202306262110.NCIrjtZF-lkp@intel.com/config) compiler: clang version 15.0.7 (https://github.com/llvm/llvm-project.git 8dfdcc7b7bf66834a761bd8de445840ef68e4d1a) reproduce: (https://download.01.org/0day-ci/archive/20230626/202306262110.NCIrjtZF-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/202306262110.NCIrjtZF-lkp@intel.com/ All warnings (new ones prefixed by >>): >> drivers/crypto/intel/qat/qat_common/qat_uclo.c:1989:12: warning: comparison of distinct pointer types ('typeof (words_num) *' (aka 'unsigned int *') and 'typeof (1024) *' (aka 'int *')) [-Wcompare-distinct-pointer-types] cpylen = min(words_num, UWORD_CPYBUF_SIZE); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/minmax.h:67:19: note: expanded from macro 'min' #define min(x, y) __careful_cmp(x, y, <) ^~~~~~~~~~~~~~~~~~~~~~ include/linux/minmax.h:36:24: note: expanded from macro '__careful_cmp' __builtin_choose_expr(__safe_cmp(x, y), \ ^~~~~~~~~~~~~~~~ include/linux/minmax.h:26:4: note: expanded from macro '__safe_cmp' (__typecheck(x, y) && __no_side_effects(x, y)) ^~~~~~~~~~~~~~~~~ include/linux/minmax.h:20:28: note: expanded from macro '__typecheck' (!!(sizeof((typeof(x) *)1 == (typeof(y) *)1))) ~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~ 1 warning generated. vim +1989 drivers/crypto/intel/qat/qat_common/qat_uclo.c 1972 1973 static void qat_uclo_wr_uimage_raw_page(struct icp_qat_fw_loader_handle *handle, 1974 struct icp_qat_uclo_encap_page 1975 *encap_page, unsigned int ae) 1976 { 1977 unsigned int uw_physical_addr, uw_relative_addr, i, words_num, cpylen; 1978 struct icp_qat_uclo_objhandle *obj_handle = handle->obj_handle; 1979 u64 fill_pat; 1980 1981 /* load the page starting at appropriate ustore address */ 1982 /* get fill-pattern from an image -- they are all the same */ 1983 memcpy(&fill_pat, obj_handle->ae_uimage[0].img_ptr->fill_pattern, 1984 sizeof(u64)); 1985 uw_physical_addr = encap_page->beg_addr_p; 1986 uw_relative_addr = 0; 1987 words_num = encap_page->micro_words_num; 1988 while (words_num) { > 1989 cpylen = min(words_num, UWORD_CPYBUF_SIZE); 1990 1991 /* load the buffer */ 1992 for (i = 0; i < cpylen; i++) 1993 qat_uclo_fill_uwords(obj_handle, encap_page, 1994 &obj_handle->uword_buf[i], 1995 uw_physical_addr + i, 1996 uw_relative_addr + i, fill_pat); 1997 1998 /* copy the buffer to ustore */ 1999 qat_hal_wr_uwords(handle, (unsigned char)ae, 2000 uw_physical_addr, cpylen, 2001 obj_handle->uword_buf); 2002 2003 uw_physical_addr += cpylen; 2004 uw_relative_addr += cpylen; 2005 words_num -= cpylen; 2006 } 2007 } 2008
diff --git a/drivers/crypto/intel/qat/qat_common/qat_uclo.c b/drivers/crypto/intel/qat/qat_common/qat_uclo.c index ce837bcc1cab..56a1947c64ab 100644 --- a/drivers/crypto/intel/qat/qat_common/qat_uclo.c +++ b/drivers/crypto/intel/qat/qat_common/qat_uclo.c @@ -1986,10 +1986,7 @@ static void qat_uclo_wr_uimage_raw_page(struct icp_qat_fw_loader_handle *handle, uw_relative_addr = 0; words_num = encap_page->micro_words_num; while (words_num) { - if (words_num < UWORD_CPYBUF_SIZE) - cpylen = words_num; - else - cpylen = UWORD_CPYBUF_SIZE; + cpylen = min(words_num, UWORD_CPYBUF_SIZE); /* load the buffer */ for (i = 0; i < cpylen; i++)
replace the if statement with min() to make the code clean Signed-off-by: You Kangren <youkangren@vivo.com> --- drivers/crypto/intel/qat/qat_common/qat_uclo.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)