All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: kbuild@lists.01.org
Subject: Re: [PATCH 3/3] staging: pi433: validate max bit_rate based on modulation used
Date: Sun, 16 Jan 2022 23:58:09 +0800	[thread overview]
Message-ID: <202201162347.q7kqawfx-lkp@intel.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 4554 bytes --]

CC: kbuild-all(a)lists.01.org
In-Reply-To: <20220116002333.GA23305@mail.google.com>
References: <20220116002333.GA23305@mail.google.com>
TO: Paulo Miguel Almeida <paulo.miguel.almeida.rodenas@gmail.com>
TO: gregkh(a)linuxfoundation.org
TO: paulo.miguel.almeida.rodenas(a)gmail.com
TO: realwakka(a)gmail.com
CC: linux-staging(a)lists.linux.dev
CC: linux-kernel(a)vger.kernel.org

Hi Paulo,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on staging/staging-testing]

url:    https://github.com/0day-ci/linux/commits/Paulo-Miguel-Almeida/staging-pi433-validate-min-max-bit-rate-settings/20220116-082432
base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git fa783154524a71ab74e293cd8251155e5971952b
:::::: branch date: 16 hours ago
:::::: commit date: 16 hours ago
config: m68k-randconfig-m031-20220116 (https://download.01.org/0day-ci/archive/20220116/202201162347.q7kqawfx-lkp(a)intel.com/config)
compiler: m68k-linux-gcc (GCC) 11.2.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

smatch warnings:
drivers/staging/pi433/rf69.c:238 rf69_set_bit_rate() warn: impossible condition '(bit_rate > 300000) => (0-u16max > 300000)'

vim +238 drivers/staging/pi433/rf69.c

874bcba65f9a3a Marcus Wolf          2017-07-16  220  
31e045ab546fa6 Valentin Vidic       2018-03-14  221  int rf69_set_bit_rate(struct spi_device *spi, u16 bit_rate)
874bcba65f9a3a Marcus Wolf          2017-07-16  222  {
874bcba65f9a3a Marcus Wolf          2017-07-16  223  	int retval;
31e045ab546fa6 Valentin Vidic       2018-03-14  224  	u32 bit_rate_reg;
874bcba65f9a3a Marcus Wolf          2017-07-16  225  	u8 msb;
874bcba65f9a3a Marcus Wolf          2017-07-16  226  	u8 lsb;
4bbc9e444fd3ba Paulo Miguel Almeida 2022-01-16  227  	enum modulation mod;
4bbc9e444fd3ba Paulo Miguel Almeida 2022-01-16  228  
4bbc9e444fd3ba Paulo Miguel Almeida 2022-01-16  229  	// check if modulation is configured
4bbc9e444fd3ba Paulo Miguel Almeida 2022-01-16  230  	mod = rf69_get_modulation(spi);
4bbc9e444fd3ba Paulo Miguel Almeida 2022-01-16  231  	if (mod == UNDEF) {
4bbc9e444fd3ba Paulo Miguel Almeida 2022-01-16  232  		dev_dbg(&spi->dev, "setBitRate: modulation is undefined");
4bbc9e444fd3ba Paulo Miguel Almeida 2022-01-16  233  		return -EINVAL;
4bbc9e444fd3ba Paulo Miguel Almeida 2022-01-16  234  	}
874bcba65f9a3a Marcus Wolf          2017-07-16  235  
874bcba65f9a3a Marcus Wolf          2017-07-16  236  	// check input value
4bbc9e444fd3ba Paulo Miguel Almeida 2022-01-16  237  	if (bit_rate < 1200 ||
4bbc9e444fd3ba Paulo Miguel Almeida 2022-01-16 @238  	    (mod == FSK && bit_rate > 300000) ||
4bbc9e444fd3ba Paulo Miguel Almeida 2022-01-16  239  	    (mod == OOK && bit_rate > 32768)) {
874bcba65f9a3a Marcus Wolf          2017-07-16  240  		dev_dbg(&spi->dev, "setBitRate: illegal input param");
e221b2b11bdc3f Marcin Ciupak        2017-08-17  241  		return -EINVAL;
874bcba65f9a3a Marcus Wolf          2017-07-16  242  	}
874bcba65f9a3a Marcus Wolf          2017-07-16  243  
874bcba65f9a3a Marcus Wolf          2017-07-16  244  	// calculate reg settings
31e045ab546fa6 Valentin Vidic       2018-03-14  245  	bit_rate_reg = (F_OSC / bit_rate);
874bcba65f9a3a Marcus Wolf          2017-07-16  246  
31e045ab546fa6 Valentin Vidic       2018-03-14  247  	msb = (bit_rate_reg & 0xff00) >> 8;
31e045ab546fa6 Valentin Vidic       2018-03-14  248  	lsb = (bit_rate_reg & 0xff);
874bcba65f9a3a Marcus Wolf          2017-07-16  249  
874bcba65f9a3a Marcus Wolf          2017-07-16  250  	// transmit to RF 69
d7b8943cf44d46 Marcus Wolf          2017-12-04  251  	retval = rf69_write_reg(spi, REG_BITRATE_MSB, msb);
4a74749a50a8f1 Marcin Ciupak        2017-10-11  252  	if (retval)
4a74749a50a8f1 Marcin Ciupak        2017-10-11  253  		return retval;
d7b8943cf44d46 Marcus Wolf          2017-12-04  254  	retval = rf69_write_reg(spi, REG_BITRATE_LSB, lsb);
4a74749a50a8f1 Marcin Ciupak        2017-10-11  255  	if (retval)
4a74749a50a8f1 Marcin Ciupak        2017-10-11  256  		return retval;
874bcba65f9a3a Marcus Wolf          2017-07-16  257  
874bcba65f9a3a Marcus Wolf          2017-07-16  258  	return 0;
874bcba65f9a3a Marcus Wolf          2017-07-16  259  }
874bcba65f9a3a Marcus Wolf          2017-07-16  260  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

             reply	other threads:[~2022-01-16 15:58 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-16 15:58 kernel test robot [this message]
  -- strict thread matches above, loose matches on Subject: below --
2022-01-16  0:17 [PATCH 0/3] staging: pi433: validate min/max bit rate settings Paulo Miguel Almeida
2022-01-16  0:23 ` [PATCH 3/3] staging: pi433: validate max bit_rate based on modulation used Paulo Miguel Almeida
2022-01-16 14:06   ` kernel test robot
2022-01-16 14:06     ` kernel test robot

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=202201162347.q7kqawfx-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=kbuild@lists.01.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.