CC: kbuild-all(a)lists.01.org In-Reply-To: <20200914122811.3295678-2-andrew@aj.id.au> References: <20200914122811.3295678-2-andrew@aj.id.au> TO: Andrew Jeffery Hi Andrew, [FYI, it's a private test report for your RFC patch.] [auto build test WARNING on wsa/i2c/for-next] [also build test WARNING on hwmon/hwmon-next v5.9-rc5 next-20200914] [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/0day-ci/linux/commits/Andrew-Jeffery/Throttle-I2C-transfers-to-UCD9000-devices/20200915-012501 base: https://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux.git i2c/for-next :::::: branch date: 13 hours ago :::::: commit date: 13 hours ago config: mips-randconfig-s031-20200913 (attached as .config) compiler: mips-linux-gcc (GCC) 9.3.0 reproduce: wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # apt-get install sparse # sparse version: v0.6.2-191-g10164920-dirty # save the attached .config to linux build tree COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=mips If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot sparse warnings: (new ones prefixed by >>) >> drivers/i2c/i2c-core-smbus.c:552:12: sparse: sparse: context imbalance in 'i2c_smbus_throttle_enter' - wrong count at exit >> drivers/i2c/i2c-core-smbus.c:592:9: sparse: sparse: context imbalance in 'i2c_smbus_throttle_exit' - wrong count at exit >> drivers/i2c/i2c-core-smbus.c:595:12: sparse: sparse: context imbalance in 'i2c_smbus_throttle_xfer' - wrong count at exit # https://github.com/0day-ci/linux/commit/28892a041b063ffb23690eb11e5764ac0e675823 git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Andrew-Jeffery/Throttle-I2C-transfers-to-UCD9000-devices/20200915-012501 git checkout 28892a041b063ffb23690eb11e5764ac0e675823 vim +/i2c_smbus_throttle_enter +552 drivers/i2c/i2c-core-smbus.c eef5ba1aa148ca Peter Rosin 2018-06-20 551 28892a041b063f Andrew Jeffery 2020-09-14 @552 static int i2c_smbus_throttle_enter(const struct i2c_client *client) 28892a041b063f Andrew Jeffery 2020-09-14 553 __acquires(&priv->throttle_lock) 28892a041b063f Andrew Jeffery 2020-09-14 554 { 28892a041b063f Andrew Jeffery 2020-09-14 555 struct i2c_client_priv *priv; 28892a041b063f Andrew Jeffery 2020-09-14 556 ktime_t earliest; 28892a041b063f Andrew Jeffery 2020-09-14 557 int rc; 28892a041b063f Andrew Jeffery 2020-09-14 558 28892a041b063f Andrew Jeffery 2020-09-14 559 priv = to_i2c_client_priv(client); 28892a041b063f Andrew Jeffery 2020-09-14 560 28892a041b063f Andrew Jeffery 2020-09-14 561 if (i2c_in_atomic_xfer_mode()) { 28892a041b063f Andrew Jeffery 2020-09-14 562 if (!mutex_trylock(&priv->throttle_lock)) 28892a041b063f Andrew Jeffery 2020-09-14 563 return -EAGAIN; 28892a041b063f Andrew Jeffery 2020-09-14 564 } else { 28892a041b063f Andrew Jeffery 2020-09-14 565 rc = mutex_lock_interruptible(&priv->throttle_lock); 28892a041b063f Andrew Jeffery 2020-09-14 566 if (rc) 28892a041b063f Andrew Jeffery 2020-09-14 567 return rc; 28892a041b063f Andrew Jeffery 2020-09-14 568 } 28892a041b063f Andrew Jeffery 2020-09-14 569 earliest = ktime_add_us(priv->last, priv->delay_us); 28892a041b063f Andrew Jeffery 2020-09-14 570 28892a041b063f Andrew Jeffery 2020-09-14 571 if (priv->delay_us && ktime_before(ktime_get(), earliest)) { 28892a041b063f Andrew Jeffery 2020-09-14 572 if (i2c_in_atomic_xfer_mode()) { 28892a041b063f Andrew Jeffery 2020-09-14 573 mutex_unlock(&priv->throttle_lock); 28892a041b063f Andrew Jeffery 2020-09-14 574 return -EAGAIN; 28892a041b063f Andrew Jeffery 2020-09-14 575 } 28892a041b063f Andrew Jeffery 2020-09-14 576 28892a041b063f Andrew Jeffery 2020-09-14 577 usleep_range(priv->delay_us, 2 * priv->delay_us); 28892a041b063f Andrew Jeffery 2020-09-14 578 } 28892a041b063f Andrew Jeffery 2020-09-14 579 28892a041b063f Andrew Jeffery 2020-09-14 580 return 0; 28892a041b063f Andrew Jeffery 2020-09-14 581 } 28892a041b063f Andrew Jeffery 2020-09-14 582 28892a041b063f Andrew Jeffery 2020-09-14 583 static void i2c_smbus_throttle_exit(const struct i2c_client *client) 28892a041b063f Andrew Jeffery 2020-09-14 584 __releases(&priv->throttle_lock) 28892a041b063f Andrew Jeffery 2020-09-14 585 { 28892a041b063f Andrew Jeffery 2020-09-14 586 struct i2c_client_priv *priv; 28892a041b063f Andrew Jeffery 2020-09-14 587 28892a041b063f Andrew Jeffery 2020-09-14 588 priv = to_i2c_client_priv(client); 28892a041b063f Andrew Jeffery 2020-09-14 589 28892a041b063f Andrew Jeffery 2020-09-14 590 if (priv->delay_us) 28892a041b063f Andrew Jeffery 2020-09-14 591 priv->last = ktime_get(); 28892a041b063f Andrew Jeffery 2020-09-14 @592 mutex_unlock(&priv->throttle_lock); 28892a041b063f Andrew Jeffery 2020-09-14 593 } 28892a041b063f Andrew Jeffery 2020-09-14 594 28892a041b063f Andrew Jeffery 2020-09-14 @595 static s32 i2c_smbus_throttle_xfer(const struct i2c_client *client, 28892a041b063f Andrew Jeffery 2020-09-14 596 char read_write, u8 command, int protocol, 28892a041b063f Andrew Jeffery 2020-09-14 597 union i2c_smbus_data *data) 28892a041b063f Andrew Jeffery 2020-09-14 598 { 28892a041b063f Andrew Jeffery 2020-09-14 599 s32 res; 28892a041b063f Andrew Jeffery 2020-09-14 600 28892a041b063f Andrew Jeffery 2020-09-14 601 res = i2c_smbus_throttle_enter(client); 28892a041b063f Andrew Jeffery 2020-09-14 602 if (res) 28892a041b063f Andrew Jeffery 2020-09-14 603 return res; 28892a041b063f Andrew Jeffery 2020-09-14 604 28892a041b063f Andrew Jeffery 2020-09-14 605 res = __i2c_lock_bus_helper(client->adapter); 28892a041b063f Andrew Jeffery 2020-09-14 606 if (!res) 28892a041b063f Andrew Jeffery 2020-09-14 607 res = __i2c_smbus_xfer(client->adapter, client->addr, 28892a041b063f Andrew Jeffery 2020-09-14 608 client->flags, read_write, command, 28892a041b063f Andrew Jeffery 2020-09-14 609 protocol, data); 28892a041b063f Andrew Jeffery 2020-09-14 610 i2c_unlock_bus(client->adapter, I2C_LOCK_SEGMENT); 28892a041b063f Andrew Jeffery 2020-09-14 611 28892a041b063f Andrew Jeffery 2020-09-14 612 i2c_smbus_throttle_exit(client); 28892a041b063f Andrew Jeffery 2020-09-14 613 28892a041b063f Andrew Jeffery 2020-09-14 614 return res; 28892a041b063f Andrew Jeffery 2020-09-14 615 } 28892a041b063f Andrew Jeffery 2020-09-14 616 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org