oe-kbuild.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: oe-kbuild@lists.linux.dev
Cc: lkp@intel.com, Dan Carpenter <error27@gmail.com>
Subject: Re: [PATCH] iio:proximity:hx9031as: Add TYHX HX9031AS/HX9023S sensor driver
Date: Fri, 17 May 2024 08:13:14 +0800	[thread overview]
Message-ID: <202405170824.uhEslLI0-lkp@intel.com> (raw)

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
In-Reply-To: <SN7PR12MB8101EDFA7F91A59761095A28A4E72@SN7PR12MB8101.namprd12.prod.outlook.com>
References: <SN7PR12MB8101EDFA7F91A59761095A28A4E72@SN7PR12MB8101.namprd12.prod.outlook.com>
TO: Yasin Lee <yasin.lee.x@outlook.com>
TO: jic23@kernel.org
CC: lars@metafoo.de
CC: swboyd@chromium.org
CC: nuno.a@analog.com
CC: andy.shevchenko@gmail.com
CC: u.kleine-koenig@pengutronix.de
CC: linux-iio@vger.kernel.org
CC: linux-kernel@vger.kernel.org
CC: yasin.lee.x@gmail.com
CC: yasin.lee.x@outlook.com

Hi Yasin,

kernel test robot noticed the following build warnings:

[auto build test WARNING on jic23-iio/togreg]
[also build test WARNING on linus/master v6.9 next-20240516]
[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#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Yasin-Lee/iio-proximity-hx9031as-Add-TYHX-HX9031AS-HX9023S-sensor-driver/20240515-083021
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git togreg
patch link:    https://lore.kernel.org/r/SN7PR12MB8101EDFA7F91A59761095A28A4E72%40SN7PR12MB8101.namprd12.prod.outlook.com
patch subject: [PATCH] iio:proximity:hx9031as: Add TYHX HX9031AS/HX9023S sensor driver
:::::: branch date: 2 days ago
:::::: commit date: 2 days ago
config: alpha-randconfig-r081-20240516 (https://download.01.org/0day-ci/archive/20240517/202405170824.uhEslLI0-lkp@intel.com/config)
compiler: alpha-linux-gcc (GCC) 13.2.0

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Dan Carpenter <error27@gmail.com>
| Closes: https://lore.kernel.org/r/202405170824.uhEslLI0-lkp@intel.com/

smatch warnings:
drivers/iio/proximity/hx9031as.c:1118 hx9031as_raw_data_show() error: snprintf() is printing too much 8192 vs 512
drivers/iio/proximity/hx9031as.c:1240 hx9031as_channel_en_show() error: snprintf() is printing too much 8192 vs 512
drivers/iio/proximity/hx9031as.c:1466 hx9031as_threshold_show() error: snprintf() is printing too much 8192 vs 512
drivers/iio/proximity/hx9031as.c:1491 hx9031as_dump_show() error: snprintf() is printing too much 8192 vs 1024
drivers/iio/proximity/hx9031as.c:1513 hx9031as_offset_dac_show() error: snprintf() is printing too much 8192 vs 512

vim +1118 drivers/iio/proximity/hx9031as.c

5e5a419c9407f6 Yasin Lee 2024-05-10  1109  
5e5a419c9407f6 Yasin Lee 2024-05-10  1110  static ssize_t hx9031as_raw_data_show(struct file *file, char __user *user_buf, size_t count, loff_t *ppos)
5e5a419c9407f6 Yasin Lee 2024-05-10  1111  {
5e5a419c9407f6 Yasin Lee 2024-05-10  1112  	char buf[BUF_SIZE] = {0};
5e5a419c9407f6 Yasin Lee 2024-05-10  1113  	char *p = buf;
5e5a419c9407f6 Yasin Lee 2024-05-10  1114  	int ii = 0;
5e5a419c9407f6 Yasin Lee 2024-05-10  1115  
5e5a419c9407f6 Yasin Lee 2024-05-10  1116  	hx9031as_sample();
5e5a419c9407f6 Yasin Lee 2024-05-10  1117  	for (ii = 0; ii < HX9031AS_CH_NUM; ii++) {
5e5a419c9407f6 Yasin Lee 2024-05-10 @1118  		p += snprintf(p, PAGE_SIZE, "ch[%d]: DIFF=%-8d, RAW=%-8d, OFFSET=%-8d, BL=%-8d, LP=%-8d\n",
5e5a419c9407f6 Yasin Lee 2024-05-10  1119  						ii, hx9031as_pdata.diff[ii], hx9031as_pdata.raw[ii], hx9031as_pdata.dac[ii],
5e5a419c9407f6 Yasin Lee 2024-05-10  1120  						hx9031as_pdata.bl[ii], hx9031as_pdata.lp[ii]);
5e5a419c9407f6 Yasin Lee 2024-05-10  1121  	}
5e5a419c9407f6 Yasin Lee 2024-05-10  1122  
5e5a419c9407f6 Yasin Lee 2024-05-10  1123  	return simple_read_from_buffer(user_buf, count, ppos, buf, strlen(buf));
5e5a419c9407f6 Yasin Lee 2024-05-10  1124  }
5e5a419c9407f6 Yasin Lee 2024-05-10  1125  
5e5a419c9407f6 Yasin Lee 2024-05-10  1126  static const struct file_operations hx9031as_raw_data_fops = {
5e5a419c9407f6 Yasin Lee 2024-05-10  1127  	.read = hx9031as_raw_data_show,
5e5a419c9407f6 Yasin Lee 2024-05-10  1128  };
5e5a419c9407f6 Yasin Lee 2024-05-10  1129  
5e5a419c9407f6 Yasin Lee 2024-05-10  1130  static ssize_t hx9031as_reg_write_store(struct file *file, const char __user *user_buf, size_t count, loff_t *ppos)
5e5a419c9407f6 Yasin Lee 2024-05-10  1131  {
5e5a419c9407f6 Yasin Lee 2024-05-10  1132  	int ret = -1;
5e5a419c9407f6 Yasin Lee 2024-05-10  1133  	unsigned int reg_address = 0;
5e5a419c9407f6 Yasin Lee 2024-05-10  1134  	unsigned int val = 0;
5e5a419c9407f6 Yasin Lee 2024-05-10  1135  	uint8_t addr = 0;
5e5a419c9407f6 Yasin Lee 2024-05-10  1136  	uint8_t tx_buf[1] = {0};
5e5a419c9407f6 Yasin Lee 2024-05-10  1137  	char buf[BUF_SIZE];
5e5a419c9407f6 Yasin Lee 2024-05-10  1138  
5e5a419c9407f6 Yasin Lee 2024-05-10  1139  	ENTER;
5e5a419c9407f6 Yasin Lee 2024-05-10  1140  	if (count > BUF_SIZE)
5e5a419c9407f6 Yasin Lee 2024-05-10  1141  		return -EINVAL;
5e5a419c9407f6 Yasin Lee 2024-05-10  1142  
5e5a419c9407f6 Yasin Lee 2024-05-10  1143  	if (copy_from_user(buf, user_buf, count))
5e5a419c9407f6 Yasin Lee 2024-05-10  1144  		return -EFAULT;
5e5a419c9407f6 Yasin Lee 2024-05-10  1145  
5e5a419c9407f6 Yasin Lee 2024-05-10  1146  	if (sscanf(buf, "%x,%x", &reg_address, &val) != 2) {
5e5a419c9407f6 Yasin Lee 2024-05-10  1147  		PRINT_ERR("please input two HEX numbers: aa,bb (aa: reg_address, bb: value_to_be_set)\n");
5e5a419c9407f6 Yasin Lee 2024-05-10  1148  		return -EINVAL;
5e5a419c9407f6 Yasin Lee 2024-05-10  1149  	}
5e5a419c9407f6 Yasin Lee 2024-05-10  1150  
5e5a419c9407f6 Yasin Lee 2024-05-10  1151  	addr = (uint8_t)reg_address;
5e5a419c9407f6 Yasin Lee 2024-05-10  1152  	tx_buf[0] = (uint8_t)val;
5e5a419c9407f6 Yasin Lee 2024-05-10  1153  
5e5a419c9407f6 Yasin Lee 2024-05-10  1154  	ret = hx9031as_write(addr, tx_buf, 1);
5e5a419c9407f6 Yasin Lee 2024-05-10  1155  	if (ret != 0)
5e5a419c9407f6 Yasin Lee 2024-05-10  1156  		PRINT_ERR("hx9031as_write failed\n");
5e5a419c9407f6 Yasin Lee 2024-05-10  1157  
5e5a419c9407f6 Yasin Lee 2024-05-10  1158  	PRINT_INF("WRITE:Reg0x%02X=0x%02X\n", addr, tx_buf[0]);
5e5a419c9407f6 Yasin Lee 2024-05-10  1159  	return count;
5e5a419c9407f6 Yasin Lee 2024-05-10  1160  }
5e5a419c9407f6 Yasin Lee 2024-05-10  1161  
5e5a419c9407f6 Yasin Lee 2024-05-10  1162  static const struct file_operations hx9031as_reg_write_fops = {
5e5a419c9407f6 Yasin Lee 2024-05-10  1163  	.write = hx9031as_reg_write_store,
5e5a419c9407f6 Yasin Lee 2024-05-10  1164  };
5e5a419c9407f6 Yasin Lee 2024-05-10  1165  
5e5a419c9407f6 Yasin Lee 2024-05-10  1166  static ssize_t hx9031as_reg_read_store(struct file *file, const char __user *user_buf, size_t count, loff_t *ppos)
5e5a419c9407f6 Yasin Lee 2024-05-10  1167  {
5e5a419c9407f6 Yasin Lee 2024-05-10  1168  	int ret = -1;
5e5a419c9407f6 Yasin Lee 2024-05-10  1169  	unsigned long reg_address = 0;
5e5a419c9407f6 Yasin Lee 2024-05-10  1170  	uint8_t addr = 0;
5e5a419c9407f6 Yasin Lee 2024-05-10  1171  	uint8_t rx_buf[1] = {0};
5e5a419c9407f6 Yasin Lee 2024-05-10  1172  	char buf[BUF_SIZE];
5e5a419c9407f6 Yasin Lee 2024-05-10  1173  
5e5a419c9407f6 Yasin Lee 2024-05-10  1174  	ENTER;
5e5a419c9407f6 Yasin Lee 2024-05-10  1175  	if (count > BUF_SIZE)
5e5a419c9407f6 Yasin Lee 2024-05-10  1176  		return -EINVAL;
5e5a419c9407f6 Yasin Lee 2024-05-10  1177  
5e5a419c9407f6 Yasin Lee 2024-05-10  1178  	if (copy_from_user(buf, user_buf, count))
5e5a419c9407f6 Yasin Lee 2024-05-10  1179  		return -EFAULT;
5e5a419c9407f6 Yasin Lee 2024-05-10  1180  
5e5a419c9407f6 Yasin Lee 2024-05-10  1181  	if (kstrtoul(buf, 16, &reg_address)) {
5e5a419c9407f6 Yasin Lee 2024-05-10  1182  		PRINT_ERR("please input a HEX number\n");
5e5a419c9407f6 Yasin Lee 2024-05-10  1183  		return -EINVAL;
5e5a419c9407f6 Yasin Lee 2024-05-10  1184  	}
5e5a419c9407f6 Yasin Lee 2024-05-10  1185  	addr = (uint8_t)reg_address;
5e5a419c9407f6 Yasin Lee 2024-05-10  1186  
5e5a419c9407f6 Yasin Lee 2024-05-10  1187  	ret = hx9031as_read(addr, rx_buf, 1);
5e5a419c9407f6 Yasin Lee 2024-05-10  1188  	if (ret != 0)
5e5a419c9407f6 Yasin Lee 2024-05-10  1189  		PRINT_ERR("hx9031as_read failed\n");
5e5a419c9407f6 Yasin Lee 2024-05-10  1190  
5e5a419c9407f6 Yasin Lee 2024-05-10  1191  	PRINT_INF("READ:Reg0x%02X=0x%02X\n", addr, rx_buf[0]);
5e5a419c9407f6 Yasin Lee 2024-05-10  1192  	return count;
5e5a419c9407f6 Yasin Lee 2024-05-10  1193  }
5e5a419c9407f6 Yasin Lee 2024-05-10  1194  
5e5a419c9407f6 Yasin Lee 2024-05-10  1195  static const struct file_operations hx9031as_reg_read_fops = {
5e5a419c9407f6 Yasin Lee 2024-05-10  1196  	.write = hx9031as_reg_read_store,
5e5a419c9407f6 Yasin Lee 2024-05-10  1197  };
5e5a419c9407f6 Yasin Lee 2024-05-10  1198  
5e5a419c9407f6 Yasin Lee 2024-05-10  1199  static ssize_t hx9031as_channel_en_store(struct file *file, const char __user *user_buf, size_t count, loff_t *ppos)
5e5a419c9407f6 Yasin Lee 2024-05-10  1200  {
5e5a419c9407f6 Yasin Lee 2024-05-10  1201  	int ch_id = 0;
5e5a419c9407f6 Yasin Lee 2024-05-10  1202  	int en = 0;
5e5a419c9407f6 Yasin Lee 2024-05-10  1203  	char buf[BUF_SIZE];
5e5a419c9407f6 Yasin Lee 2024-05-10  1204  
5e5a419c9407f6 Yasin Lee 2024-05-10  1205  	ENTER;
5e5a419c9407f6 Yasin Lee 2024-05-10  1206  	if (count > BUF_SIZE)
5e5a419c9407f6 Yasin Lee 2024-05-10  1207  		return -EINVAL;
5e5a419c9407f6 Yasin Lee 2024-05-10  1208  
5e5a419c9407f6 Yasin Lee 2024-05-10  1209  	if (copy_from_user(buf, user_buf, count))
5e5a419c9407f6 Yasin Lee 2024-05-10  1210  		return -EFAULT;
5e5a419c9407f6 Yasin Lee 2024-05-10  1211  
5e5a419c9407f6 Yasin Lee 2024-05-10  1212  	if (sscanf(buf, "%d,%d", &ch_id, &en) != 2) {
5e5a419c9407f6 Yasin Lee 2024-05-10  1213  		PRINT_ERR("please input two DEC numbers: ch_id,en (ch_id: channel number, en: 1=enable, 0=disable)\n");
5e5a419c9407f6 Yasin Lee 2024-05-10  1214  		return -EINVAL;
5e5a419c9407f6 Yasin Lee 2024-05-10  1215  	}
5e5a419c9407f6 Yasin Lee 2024-05-10  1216  
5e5a419c9407f6 Yasin Lee 2024-05-10  1217  	if ((ch_id >= HX9031AS_CH_NUM) || (ch_id < 0)) {
5e5a419c9407f6 Yasin Lee 2024-05-10  1218  		PRINT_ERR("channel number out of range, the effective number is 0~%d\n", HX9031AS_CH_NUM - 1);
5e5a419c9407f6 Yasin Lee 2024-05-10  1219  		return -EINVAL;
5e5a419c9407f6 Yasin Lee 2024-05-10  1220  	}
5e5a419c9407f6 Yasin Lee 2024-05-10  1221  
5e5a419c9407f6 Yasin Lee 2024-05-10  1222  	if ((hx9031as_pdata.channel_used_flag >> ch_id) & 0x01)
5e5a419c9407f6 Yasin Lee 2024-05-10  1223  		hx9031as_ch_en_hal(ch_id, (en > 0) ? 1 : 0);
5e5a419c9407f6 Yasin Lee 2024-05-10  1224  	else
5e5a419c9407f6 Yasin Lee 2024-05-10  1225  		PRINT_ERR("ch_%d is unused, you can not enable or disable an unused channel\n", ch_id);
5e5a419c9407f6 Yasin Lee 2024-05-10  1226  
5e5a419c9407f6 Yasin Lee 2024-05-10  1227  	return count;
5e5a419c9407f6 Yasin Lee 2024-05-10  1228  }
5e5a419c9407f6 Yasin Lee 2024-05-10  1229  
5e5a419c9407f6 Yasin Lee 2024-05-10  1230  static ssize_t hx9031as_channel_en_show(struct file *file, char __user *user_buf, size_t count, loff_t *ppos)
5e5a419c9407f6 Yasin Lee 2024-05-10  1231  {
5e5a419c9407f6 Yasin Lee 2024-05-10  1232  	char buf[BUF_SIZE] = {0};
5e5a419c9407f6 Yasin Lee 2024-05-10  1233  	char *p = buf;
5e5a419c9407f6 Yasin Lee 2024-05-10  1234  	int ii = 0;
5e5a419c9407f6 Yasin Lee 2024-05-10  1235  
5e5a419c9407f6 Yasin Lee 2024-05-10  1236  	for (ii = 0; ii < HX9031AS_CH_NUM; ii++) {
5e5a419c9407f6 Yasin Lee 2024-05-10  1237  		if ((hx9031as_pdata.channel_used_flag >> ii) & 0x1) {
5e5a419c9407f6 Yasin Lee 2024-05-10  1238  			PRINT_INF("hx9031as_pdata.chs_info[%d].enabled=%d\n",
5e5a419c9407f6 Yasin Lee 2024-05-10  1239  						ii, hx9031as_pdata.chs_info[ii].enabled);
5e5a419c9407f6 Yasin Lee 2024-05-10 @1240  			p += snprintf(p, PAGE_SIZE, "hx9031as_pdata.chs_info[%d].enabled=%d\n",
5e5a419c9407f6 Yasin Lee 2024-05-10  1241  						ii, hx9031as_pdata.chs_info[ii].enabled);
5e5a419c9407f6 Yasin Lee 2024-05-10  1242  		}
5e5a419c9407f6 Yasin Lee 2024-05-10  1243  	}
5e5a419c9407f6 Yasin Lee 2024-05-10  1244  
5e5a419c9407f6 Yasin Lee 2024-05-10  1245  	return simple_read_from_buffer(user_buf, count, ppos, buf, strlen(buf));
5e5a419c9407f6 Yasin Lee 2024-05-10  1246  }
5e5a419c9407f6 Yasin Lee 2024-05-10  1247  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

             reply	other threads:[~2024-05-17  0:13 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-17  0:13 kernel test robot [this message]
     [not found] <SN7PR12MB8101EDFA7F91A59761095A28A4E72@SN7PR12MB8101.namprd12.prod.outlook.com>
2024-05-23 12:42 ` [PATCH] iio:proximity:hx9031as: Add TYHX HX9031AS/HX9023S sensor driver Dan Carpenter
2024-05-25 14:00   ` Andy Shevchenko
2024-05-27  8:14     ` Dan Carpenter
2024-05-27  8:50       ` Dan Carpenter
2024-05-27  9:07         ` Dan Carpenter

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=202405170824.uhEslLI0-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=error27@gmail.com \
    --cc=oe-kbuild@lists.linux.dev \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).