Re: [PATCH v2 2/2] iio: chemical: Add driver support for sgp40

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Andreas,

I love your patch! Perhaps something to improve:

[auto build test WARNING on iio/togreg]
[also build test WARNING on robh/for-next linus/master v5.14-rc4 next-20210804]
[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/Andreas-Klinger/iio-chemical-Add-support-for-sgp40-gas-sensor/20210804-234955
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git togreg
config: x86_64-buildonly-randconfig-r001-20210804 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 4f71f59bf3d9914188a11d0c41bedbb339d36ff5)
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/0day-ci/linux/commit/c122fa429b69b2cf1d2546043c4ba21c715fa3cb
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Andreas-Klinger/iio-chemical-Add-support-for-sgp40-gas-sensor/20210804-234955
        git checkout c122fa429b69b2cf1d2546043c4ba21c715fa3cb
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All warnings (new ones prefixed by >>):

>> drivers/iio/chemical/sgp40.c:186:68: warning: format specifies type 'int' but the argument has type 'unsigned long' [-Wformat]
                   dev_warn(data->dev, "i2c_master_send ret: %d sizeof: %d\n", ret, sizeof(tg));
                                                                        ~~          ^~~~~~~~~~
                                                                        %lu
   include/linux/dev_printk.h:114:33: note: expanded from macro 'dev_warn'
           _dev_warn(dev, dev_fmt(fmt), ##__VA_ARGS__)
                                  ~~~     ^~~~~~~~~~~
   drivers/iio/chemical/sgp40.c:195:68: warning: format specifies type 'int' but the argument has type 'unsigned long' [-Wformat]
                   dev_warn(data->dev, "i2c_master_recv ret: %d sizeof: %d\n", ret, sizeof(tgres));
                                                                        ~~          ^~~~~~~~~~~~~
                                                                        %lu
   include/linux/dev_printk.h:114:33: note: expanded from macro 'dev_warn'
           _dev_warn(dev, dev_fmt(fmt), ##__VA_ARGS__)
                                  ~~~     ^~~~~~~~~~~
   2 warnings generated.


vim +186 drivers/iio/chemical/sgp40.c

   159	
   160	static int sgp40_measure_resistance_raw(struct sgp40_data *data, u16 *resistance_raw)
   161	{
   162		int ret;
   163		struct i2c_client *client = data->client;
   164		u32 ticks;
   165		u16 ticks16;
   166		u8 crc;
   167		struct sgp40_tg_measure tg = {.command = {0x26, 0x0F}};
   168		struct sgp40_tg_result tgres;
   169	
   170		mutex_lock(&data->lock);
   171		
   172		ticks = (data->rht / 10) * 65535 / 10000;
   173		ticks16 = (u16)clamp(ticks, 0u, 65535u); /* clamp between 0 .. 100 %rH */
   174		tg.rht_ticks = cpu_to_be16(ticks16);
   175		tg.rht_crc = crc8(sgp40_crc8_table, (u8 *)&tg.rht_ticks, 2, SGP40_CRC8_INIT);
   176	
   177		ticks = ((data->temp + 45000) / 10 ) * 65535 / 17500;
   178		ticks16 = (u16)clamp(ticks, 0u, 65535u); /* clamp between -45 .. +130 °C */
   179		tg.temp_ticks = cpu_to_be16(ticks16);
   180		tg.temp_crc = crc8(sgp40_crc8_table, (u8 *)&tg.temp_ticks, 2, SGP40_CRC8_INIT);
   181	
   182		mutex_unlock(&data->lock);
   183	
   184		ret = i2c_master_send(client, (const char *)&tg, sizeof(tg));
   185		if (ret != sizeof(tg)) {
 > 186			dev_warn(data->dev, "i2c_master_send ret: %d sizeof: %d\n", ret, sizeof(tg));
   187			return -EIO;
   188		}
   189		msleep(30);
   190	
   191		ret = i2c_master_recv(client, (u8 *)&tgres, sizeof(tgres));
   192		if (ret < 0)
   193			return ret;
   194		if (ret != sizeof(tgres)) {
   195			dev_warn(data->dev, "i2c_master_recv ret: %d sizeof: %d\n", ret, sizeof(tgres));
   196			return -EIO;
   197		}
   198	
   199		crc = crc8(sgp40_crc8_table, (u8 *)&tgres.res_ticks, 2, SGP40_CRC8_INIT);
   200		if (crc != tgres.res_crc) {
   201			dev_err(data->dev, "CRC error while measure-raw\n");
   202			return -EIO;
   203		}
   204	
   205		*resistance_raw = be16_to_cpu(tgres.res_ticks);
   206	
   207		return 0;
   208	}
   209	

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

Attachment: .config.gz
Description: application/gzip


[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux