Re: [PATCH V1 3/3] rpmsg: char: Add TIOCMGET/TIOCMSET ioctl support

From: kernel test robot
Date: Thu Nov 11 2021 - 21:51:38 EST


Hi Deepak,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on linus/master]
[also build test WARNING on v5.15]
[cannot apply to next-20211108]
[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/Deepak-Kumar-Singh/rpmsg-core-Add-signal-API-support/20211001-003225
base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 02d5e016800d082058b3d3b7c3ede136cdc6ddcb
config: x86_64-randconfig-c007-20211001 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 962e503cc8bc411f7523cc393acae8aae425b1c4)
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/706239528659b90d79d28e52fcd0538747e66a86
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Deepak-Kumar-Singh/rpmsg-core-Add-signal-API-support/20211001-003225
git checkout 706239528659b90d79d28e52fcd0538747e66a86
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 clang-analyzer

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


clang-analyzer warnings: (new ones prefixed by >>)

>> drivers/rpmsg/rpmsg_char.c:310:3: warning: Value stored to 'ret' is never read [clang-analyzer-deadcode.DeadStores]
ret = put_user(eptdev->rsigs, (int __user *)arg);
^
drivers/rpmsg/rpmsg_char.c:317:3: warning: Value stored to 'ret' is never read [clang-analyzer-deadcode.DeadStores]
ret = rpmsg_set_flow_control(eptdev->ept, set);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/rpmsg/rpmsg_char.c:320:3: warning: Value stored to 'ret' is never read [clang-analyzer-deadcode.DeadStores]
ret = rpmsg_eptdev_destroy(&eptdev->dev, NULL);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/rpmsg/rpmsg_char.c:323:3: warning: Value stored to 'ret' is never read [clang-analyzer-deadcode.DeadStores]
ret = -EINVAL;
^ ~~~~~~~


vim +/ret +310 drivers/rpmsg/rpmsg_char.c

c0cdc19f84a4712 Bjorn Andersson 2017-01-11 295
c0cdc19f84a4712 Bjorn Andersson 2017-01-11 296 static long rpmsg_eptdev_ioctl(struct file *fp, unsigned int cmd,
c0cdc19f84a4712 Bjorn Andersson 2017-01-11 297 unsigned long arg)
c0cdc19f84a4712 Bjorn Andersson 2017-01-11 298 {
c0cdc19f84a4712 Bjorn Andersson 2017-01-11 299 struct rpmsg_eptdev *eptdev = fp->private_data;
706239528659b90 Deepak Kumar Singh 2021-09-30 300 bool set;
706239528659b90 Deepak Kumar Singh 2021-09-30 301 u32 val;
706239528659b90 Deepak Kumar Singh 2021-09-30 302 int ret;
c0cdc19f84a4712 Bjorn Andersson 2017-01-11 303
c0cdc19f84a4712 Bjorn Andersson 2017-01-11 304 if (cmd != RPMSG_DESTROY_EPT_IOCTL)
c0cdc19f84a4712 Bjorn Andersson 2017-01-11 305 return -EINVAL;
c0cdc19f84a4712 Bjorn Andersson 2017-01-11 306
706239528659b90 Deepak Kumar Singh 2021-09-30 307 switch (cmd) {
706239528659b90 Deepak Kumar Singh 2021-09-30 308 case TIOCMGET:
706239528659b90 Deepak Kumar Singh 2021-09-30 309 eptdev->sig_pending = false;
706239528659b90 Deepak Kumar Singh 2021-09-30 @310 ret = put_user(eptdev->rsigs, (int __user *)arg);
706239528659b90 Deepak Kumar Singh 2021-09-30 311 break;
706239528659b90 Deepak Kumar Singh 2021-09-30 312 case TIOCMSET:
706239528659b90 Deepak Kumar Singh 2021-09-30 313 ret = get_user(val, (int __user *)arg);
706239528659b90 Deepak Kumar Singh 2021-09-30 314 if (ret)
706239528659b90 Deepak Kumar Singh 2021-09-30 315 break;
706239528659b90 Deepak Kumar Singh 2021-09-30 316 set = (val & TIOCM_DTR) ? true : false;
706239528659b90 Deepak Kumar Singh 2021-09-30 @317 ret = rpmsg_set_flow_control(eptdev->ept, set);
706239528659b90 Deepak Kumar Singh 2021-09-30 318 break;
706239528659b90 Deepak Kumar Singh 2021-09-30 319 case RPMSG_DESTROY_EPT_IOCTL:
706239528659b90 Deepak Kumar Singh 2021-09-30 @320 ret = rpmsg_eptdev_destroy(&eptdev->dev, NULL);
706239528659b90 Deepak Kumar Singh 2021-09-30 321 break;
706239528659b90 Deepak Kumar Singh 2021-09-30 322 default:
706239528659b90 Deepak Kumar Singh 2021-09-30 @323 ret = -EINVAL;
706239528659b90 Deepak Kumar Singh 2021-09-30 324 }
706239528659b90 Deepak Kumar Singh 2021-09-30 325
c0cdc19f84a4712 Bjorn Andersson 2017-01-11 326 return rpmsg_eptdev_destroy(&eptdev->dev, NULL);
c0cdc19f84a4712 Bjorn Andersson 2017-01-11 327 }
c0cdc19f84a4712 Bjorn Andersson 2017-01-11 328

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

Attachment: .config.gz
Description: application/gzip