[PATCH 15/19] ipmi: kcs_bmc: Add a "raw" character device interface
kernel test robot
lkp at intel.com
Mon Feb 22 00:54:32 AEDT 2021
Hi Andrew,
I love your patch! Perhaps something to improve:
[auto build test WARNING on char-misc/char-misc-testing]
[also build test WARNING on v5.11]
[cannot apply to joel-aspeed/for-next next-20210219]
[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/ipmi-Allow-raw-access-to-KCS-devices/20210219-223144
base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git d19db80a366576d3ffadf2508ed876b4c1faf959
config: parisc-randconfig-r034-20210221 (attached as .config)
compiler: hppa-linux-gcc (GCC) 9.3.0
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/8af4fb76b1183097f52d3c67196ae4dbadf508b2
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Andrew-Jeffery/ipmi-Allow-raw-access-to-KCS-devices/20210219-223144
git checkout 8af4fb76b1183097f52d3c67196ae4dbadf508b2
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=parisc
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp at intel.com>
All warnings (new ones prefixed by >>):
drivers/char/ipmi/kcs_bmc_cdev_raw.c: In function 'kcs_bmc_raw_write':
>> drivers/char/ipmi/kcs_bmc_cdev_raw.c:253:10: warning: variable 'result' set but not used [-Wunused-but-set-variable]
253 | ssize_t result;
| ^~~~~~
vim +/result +253 drivers/char/ipmi/kcs_bmc_cdev_raw.c
244
245 static ssize_t kcs_bmc_raw_write(struct file *filp, const char __user *buf,
246 size_t count, loff_t *ppos)
247 {
248 struct kcs_bmc_device *kcs_bmc;
249 bool write_odr, write_str;
250 struct kcs_bmc_raw *priv;
251 struct device *dev;
252 uint8_t data[2];
> 253 ssize_t result;
254 u8 str;
255
256 priv = file_to_kcs_bmc_raw(filp);
257 kcs_bmc = priv->client.dev;
258 dev = priv->miscdev.this_device;
259
260 if (!count)
261 return count;
262
263 if (count > 2)
264 return -EINVAL;
265
266 if (*ppos >= 2)
267 return -EINVAL;
268
269 if (*ppos + count > 2)
270 return -EINVAL;
271
272 if (copy_from_user(data, buf, count))
273 return -EFAULT;
274
275 write_odr = (*ppos == 0);
276 write_str = (*ppos == 1) || (count == 2);
277
278 spin_lock_irq(&priv->queue.lock);
279
280 /* Always write status before data, we generate the SerIRQ by writing ODR */
281 if (write_str) {
282 /* The index of STR in the userspace buffer depends on whether ODR is written */
283 str = data[*ppos == 0];
284 if (!(str & KCS_BMC_STR_OBF))
285 dev_warn(dev, "Clearing OBF with status write: 0x%x\n", str);
286 dev_dbg(dev, "Writing status 0x%x\n", str);
287 kcs_bmc_write_status(kcs_bmc, str);
288 }
289
290 if (write_odr) {
291 /* If we're writing ODR it's always the first byte in the buffer */
292 u8 odr = data[0];
293
294 str = kcs_bmc_read_status(kcs_bmc);
295 if (str & KCS_BMC_STR_OBF) {
296 if (filp->f_flags & O_NONBLOCK) {
297 result = -EWOULDBLOCK;
298 goto out;
299 }
300
301 priv->writable = kcs_bmc_raw_prepare_obe(priv);
302
303 /* Now either OBF is already clear, or we'll get an OBE event to wake us */
304 dev_dbg(dev, "Waiting for OBF to clear\n");
305 wait_event_interruptible_locked(priv->queue, priv->writable);
306
307 if (signal_pending(current)) {
308 kcs_bmc_raw_update_event_mask(priv, KCS_BMC_EVENT_TYPE_OBE, 0);
309 result = -EINTR;
310 goto out;
311 }
312
313 WARN_ON(kcs_bmc_read_status(kcs_bmc) & KCS_BMC_STR_OBF);
314 }
315
316 dev_dbg(dev, "Writing 0x%x to ODR\n", odr);
317 kcs_bmc_write_data(kcs_bmc, odr);
318 }
319
320 out:
321 spin_unlock_irq(&priv->queue.lock);
322
323 return count;
324 }
325
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/gzip
Size: 34098 bytes
Desc: not available
URL: <http://lists.ozlabs.org/pipermail/openbmc/attachments/20210221/77ead364/attachment-0001.gz>
More information about the openbmc
mailing list