lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <202206292048.draQ6KZs-lkp@intel.com>
Date:   Wed, 29 Jun 2022 21:02:01 +0800
From:   kernel test robot <lkp@...el.com>
To:     Vijaya Krishna Nivarthi <quic_vnivarth@...cinc.com>,
        agross@...nel.org, bjorn.andersson@...aro.org,
        konrad.dybcio@...ainline.org, gregkh@...uxfoundation.org,
        jirislaby@...nel.org, linux-arm-msm@...r.kernel.org,
        linux-serial@...r.kernel.org, linux-kernel@...r.kernel.org
Cc:     kbuild-all@...ts.01.org, quic_msavaliy@...cinc.com,
        dianders@...omium.org, mka@...omium.org, swboyd@...omium.org,
        Vijaya Krishna Nivarthi <quic_vnivarth@...cinc.com>
Subject: Re: [V2] tty: serial: qcom-geni-serial: Fix get_clk_div_rate() which
 otherwise could return a sub-optimal clock rate.

Hi Vijaya,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on tty/tty-testing]
[also build test WARNING on linus/master v5.19-rc4 next-20220629]
[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]

url:    https://github.com/intel-lab-lkp/linux/commits/Vijaya-Krishna-Nivarthi/tty-serial-qcom-geni-serial-Fix-get_clk_div_rate-which-otherwise-could-return-a-sub-optimal-clock-rate/20220629-180330
base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git tty-testing
config: mips-allyesconfig
compiler: mips-linux-gcc (GCC) 11.3.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/intel-lab-lkp/linux/commit/a70b5a9759aef627b6882576f38399ed8c092b74
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Vijaya-Krishna-Nivarthi/tty-serial-qcom-geni-serial-Fix-get_clk_div_rate-which-otherwise-could-return-a-sub-optimal-clock-rate/20220629-180330
        git checkout a70b5a9759aef627b6882576f38399ed8c092b74
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.3.0 make.cross W=1 O=build_dir ARCH=mips SHELL=/bin/bash drivers/tty/serial/

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@...el.com>

All warnings (new ones prefixed by >>):

   In file included from include/linux/kernel.h:29,
                    from include/linux/clk.h:13,
                    from drivers/tty/serial/qcom_geni_serial.c:4:
   drivers/tty/serial/qcom_geni_serial.c: In function 'get_clk_div_rate':
   include/linux/kern_levels.h:5:25: warning: format '%d' expects argument of type 'int', but argument 2 has type 'long unsigned int' [-Wformat=]
       5 | #define KERN_SOH        "\001"          /* ASCII Start Of Header */
         |                         ^~~~~~
   include/linux/printk.h:452:25: note: in definition of macro 'printk_index_wrap'
     452 |                 _p_func(_fmt, ##__VA_ARGS__);                           \
         |                         ^~~~
   include/linux/printk.h:523:9: note: in expansion of macro 'printk'
     523 |         printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
         |         ^~~~~~
   include/linux/kern_levels.h:11:25: note: in expansion of macro 'KERN_SOH'
      11 | #define KERN_ERR        KERN_SOH "3"    /* error conditions */
         |                         ^~~~~~~~
   include/linux/printk.h:523:16: note: in expansion of macro 'KERN_ERR'
     523 |         printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
         |                ^~~~~~~~
   drivers/tty/serial/qcom_geni_serial.c:1044:17: note: in expansion of macro 'pr_err'
    1044 |                 pr_err("Couldn't find suitable clock rate for %d\n", desired_clk);
         |                 ^~~~~~
   In file included from include/linux/kernel.h:29,
                    from include/linux/clk.h:13,
                    from drivers/tty/serial/qcom_geni_serial.c:4:
>> drivers/tty/serial/qcom_geni_serial.c:1046:26: warning: format '%d' expects argument of type 'int', but argument 3 has type 'long unsigned int' [-Wformat=]
    1046 |                 pr_debug("desired_clk-%d, ser_clk-%d, clk_div-%d\n",
         |                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/printk.h:370:21: note: in definition of macro 'pr_fmt'
     370 | #define pr_fmt(fmt) fmt
         |                     ^~~
   include/linux/dynamic_debug.h:152:9: note: in expansion of macro '__dynamic_func_call'
     152 |         __dynamic_func_call(__UNIQUE_ID(ddebug), fmt, func, ##__VA_ARGS__)
         |         ^~~~~~~~~~~~~~~~~~~
   include/linux/dynamic_debug.h:162:9: note: in expansion of macro '_dynamic_func_call'
     162 |         _dynamic_func_call(fmt, __dynamic_pr_debug,             \
         |         ^~~~~~~~~~~~~~~~~~
   include/linux/printk.h:604:9: note: in expansion of macro 'dynamic_pr_debug'
     604 |         dynamic_pr_debug(fmt, ##__VA_ARGS__)
         |         ^~~~~~~~~~~~~~~~
   drivers/tty/serial/qcom_geni_serial.c:1046:17: note: in expansion of macro 'pr_debug'
    1046 |                 pr_debug("desired_clk-%d, ser_clk-%d, clk_div-%d\n",
         |                 ^~~~~~~~
   drivers/tty/serial/qcom_geni_serial.c:1046:40: note: format string is defined here
    1046 |                 pr_debug("desired_clk-%d, ser_clk-%d, clk_div-%d\n",
         |                                       ~^
         |                                        |
         |                                        int
         |                                       %ld
   In file included from include/linux/kernel.h:29,
                    from include/linux/clk.h:13,
                    from drivers/tty/serial/qcom_geni_serial.c:4:
   drivers/tty/serial/qcom_geni_serial.c:1046:26: warning: format '%d' expects argument of type 'int', but argument 4 has type 'long unsigned int' [-Wformat=]
    1046 |                 pr_debug("desired_clk-%d, ser_clk-%d, clk_div-%d\n",
         |                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/printk.h:370:21: note: in definition of macro 'pr_fmt'
     370 | #define pr_fmt(fmt) fmt
         |                     ^~~
   include/linux/dynamic_debug.h:152:9: note: in expansion of macro '__dynamic_func_call'
     152 |         __dynamic_func_call(__UNIQUE_ID(ddebug), fmt, func, ##__VA_ARGS__)
         |         ^~~~~~~~~~~~~~~~~~~
   include/linux/dynamic_debug.h:162:9: note: in expansion of macro '_dynamic_func_call'
     162 |         _dynamic_func_call(fmt, __dynamic_pr_debug,             \
         |         ^~~~~~~~~~~~~~~~~~
   include/linux/printk.h:604:9: note: in expansion of macro 'dynamic_pr_debug'
     604 |         dynamic_pr_debug(fmt, ##__VA_ARGS__)
         |         ^~~~~~~~~~~~~~~~
   drivers/tty/serial/qcom_geni_serial.c:1046:17: note: in expansion of macro 'pr_debug'
    1046 |                 pr_debug("desired_clk-%d, ser_clk-%d, clk_div-%d\n",
         |                 ^~~~~~~~
   drivers/tty/serial/qcom_geni_serial.c:1046:52: note: format string is defined here
    1046 |                 pr_debug("desired_clk-%d, ser_clk-%d, clk_div-%d\n",
         |                                                   ~^
         |                                                    |
         |                                                    int
         |                                                   %ld


vim +1046 drivers/tty/serial/qcom_geni_serial.c

  1021	
  1022	static unsigned long get_clk_div_rate(struct clk *clk, unsigned int baud,
  1023				unsigned int sampling_rate, unsigned int *clk_div)
  1024	{
  1025		unsigned long ser_clk;
  1026		unsigned long desired_clk;
  1027	
  1028		desired_clk = baud * sampling_rate;
  1029		if (!desired_clk) {
  1030			pr_err("%s: Invalid frequency\n", __func__);
  1031			return 0;
  1032		}
  1033	
  1034		ser_clk = 0;
  1035		/*
  1036		 * try to find exact clock rate or within 2% tolerance,
  1037		 * then within 5% tolerance
  1038		 */
  1039		ser_clk = find_clk_rate_in_tol(clk, desired_clk, clk_div, 2, true);
  1040		if (!ser_clk)
  1041			ser_clk = find_clk_rate_in_tol(clk, desired_clk, clk_div, 5, false);
  1042	
  1043		if (!ser_clk)
> 1044			pr_err("Couldn't find suitable clock rate for %d\n", desired_clk);
  1045		else
> 1046			pr_debug("desired_clk-%d, ser_clk-%d, clk_div-%d\n",
  1047				desired_clk, ser_clk, *clk_div);
  1048	
  1049		return ser_clk;
  1050	}
  1051	

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

View attachment "config" of type "text/plain" (320053 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ