Hi Tomasz, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on iio/togreg] [also build test WARNING on v4.20-rc4 next-20181123] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] url: https://github.com/0day-ci/linux/commits/Tomasz-Duszynski/add-support-for-Sensirion-SPS30-PM-sensor/20181125-172634 base: https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git togreg config: x86_64-allmodconfig (attached as .config) compiler: gcc-7 (Debian 7.3.0-1) 7.3.0 reproduce: # save the attached .config to linux build tree make ARCH=x86_64 All warnings (new ones prefixed by >>): >> drivers/iio/chemical/sps30.c:69:26: warning: Variable length array is used. drivers/iio/chemical/sps30.c: In function 'sps30_read_raw': drivers/iio/chemical/sps30.c:237:7: warning: 'ret' may be used uninitialized in this function [-Wmaybe-uninitialized] if (ret) ^ vim +69 drivers/iio/chemical/sps30.c 0e4f3167f Tomasz Duszynski 2018-11-24 64 0e4f3167f Tomasz Duszynski 2018-11-24 65 static int sps30_write_then_read(struct sps30_state *state, u8 *buf, 0e4f3167f Tomasz Duszynski 2018-11-24 66 int buf_size, u8 *data, int data_size) 0e4f3167f Tomasz Duszynski 2018-11-24 67 { 0e4f3167f Tomasz Duszynski 2018-11-24 68 /* every two received data bytes are checksummed */ 0e4f3167f Tomasz Duszynski 2018-11-24 @69 u8 tmp[data_size + data_size / 2]; 0e4f3167f Tomasz Duszynski 2018-11-24 70 int ret, i; 0e4f3167f Tomasz Duszynski 2018-11-24 71 0e4f3167f Tomasz Duszynski 2018-11-24 72 /* 0e4f3167f Tomasz Duszynski 2018-11-24 73 * Sensor does not support repeated start so instead of 0e4f3167f Tomasz Duszynski 2018-11-24 74 * sending two i2c messages in a row we just send one by one. 0e4f3167f Tomasz Duszynski 2018-11-24 75 */ 0e4f3167f Tomasz Duszynski 2018-11-24 76 ret = i2c_master_send(state->client, buf, buf_size); 0e4f3167f Tomasz Duszynski 2018-11-24 77 if (ret != buf_size) 0e4f3167f Tomasz Duszynski 2018-11-24 78 return ret < 0 ? ret : -EIO; 0e4f3167f Tomasz Duszynski 2018-11-24 79 0e4f3167f Tomasz Duszynski 2018-11-24 80 if (!data) 0e4f3167f Tomasz Duszynski 2018-11-24 81 return 0; 0e4f3167f Tomasz Duszynski 2018-11-24 82 0e4f3167f Tomasz Duszynski 2018-11-24 83 ret = i2c_master_recv(state->client, tmp, sizeof(tmp)); 0e4f3167f Tomasz Duszynski 2018-11-24 84 if (ret != sizeof(tmp)) 0e4f3167f Tomasz Duszynski 2018-11-24 85 return ret < 0 ? ret : -EIO; 0e4f3167f Tomasz Duszynski 2018-11-24 86 0e4f3167f Tomasz Duszynski 2018-11-24 87 for (i = 0; i < sizeof(tmp); i += 3) { 0e4f3167f Tomasz Duszynski 2018-11-24 88 u8 crc = crc8(sps30_crc8_table, &tmp[i], 2, CRC8_INIT_VALUE); 0e4f3167f Tomasz Duszynski 2018-11-24 89 0e4f3167f Tomasz Duszynski 2018-11-24 90 if (crc != tmp[i + 2]) { 0e4f3167f Tomasz Duszynski 2018-11-24 91 dev_err(&state->client->dev, 0e4f3167f Tomasz Duszynski 2018-11-24 92 "data integrity check failed\n"); 0e4f3167f Tomasz Duszynski 2018-11-24 93 return -EIO; 0e4f3167f Tomasz Duszynski 2018-11-24 94 } 0e4f3167f Tomasz Duszynski 2018-11-24 95 0e4f3167f Tomasz Duszynski 2018-11-24 96 *data++ = tmp[i]; 0e4f3167f Tomasz Duszynski 2018-11-24 97 *data++ = tmp[i + 1]; 0e4f3167f Tomasz Duszynski 2018-11-24 98 } 0e4f3167f Tomasz Duszynski 2018-11-24 99 0e4f3167f Tomasz Duszynski 2018-11-24 100 return 0; 0e4f3167f Tomasz Duszynski 2018-11-24 101 } 0e4f3167f Tomasz Duszynski 2018-11-24 102 :::::: The code at line 69 was first introduced by commit :::::: 0e4f3167f739fa067d7e1ba672f0b46569d04d84 iio: chemical: add support for Sensirion SPS30 sensor :::::: TO: Tomasz Duszynski <tduszyns@xxxxxxxxx> :::::: CC: 0day robot <lkp@xxxxxxxxx> --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation
Attachment:
.config.gz
Description: application/gzip