[gustavoars-linux:for-next/clang-ft 1/3] drivers/mtd/chips/cfi_cmdset_0002.c:981:1: warning: non-void function does not return a value in all control paths

From: kernel test robot
Date: Fri Oct 09 2020 - 01:57:10 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/gustavoars/linux.git for-next/clang-ft
head: de6b606b07e40c037ed4f83b53ee541692a78c6e
commit: 19be9a9946b4bf79ad752f4d1376509fb69e9250 [1/3] treewide: Fix fall-through warnings for Clang
config: riscv-randconfig-r004-20201009 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 4cfc4025cc1433ca5ef1c526053fc9c4bfe64109)
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
# install riscv cross compiling tool for clang build
# apt-get install binutils-riscv64-linux-gnu
# https://git.kernel.org/pub/scm/linux/kernel/git/gustavoars/linux.git/commit/?id=19be9a9946b4bf79ad752f4d1376509fb69e9250
git remote add gustavoars-linux https://git.kernel.org/pub/scm/linux/kernel/git/gustavoars/linux.git
git fetch --no-tags gustavoars-linux for-next/clang-ft
git checkout 19be9a9946b4bf79ad752f4d1376509fb69e9250
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=riscv

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/mtd/chips/cfi_cmdset_0002.c:981:1: warning: non-void function does not return a value in all control paths [-Wreturn-type]
}
^
1 warning generated.

vim +981 drivers/mtd/chips/cfi_cmdset_0002.c

fb4a90bfcd6d86 Eric W. Biedermann 2005-05-20 877
^1da177e4c3f41 Linus Torvalds 2005-04-16 878 static int get_chip(struct map_info *map, struct flchip *chip, unsigned long adr, int mode)
^1da177e4c3f41 Linus Torvalds 2005-04-16 879 {
^1da177e4c3f41 Linus Torvalds 2005-04-16 880 DECLARE_WAITQUEUE(wait, current);
^1da177e4c3f41 Linus Torvalds 2005-04-16 881 struct cfi_private *cfi = map->fldrv_priv;
^1da177e4c3f41 Linus Torvalds 2005-04-16 882 unsigned long timeo;
^1da177e4c3f41 Linus Torvalds 2005-04-16 883 struct cfi_pri_amdstd *cfip = (struct cfi_pri_amdstd *)cfi->cmdset_priv;
^1da177e4c3f41 Linus Torvalds 2005-04-16 884
^1da177e4c3f41 Linus Torvalds 2005-04-16 885 resettime:
^1da177e4c3f41 Linus Torvalds 2005-04-16 886 timeo = jiffies + HZ;
^1da177e4c3f41 Linus Torvalds 2005-04-16 887 retry:
^1da177e4c3f41 Linus Torvalds 2005-04-16 888 switch (chip->state) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 889
^1da177e4c3f41 Linus Torvalds 2005-04-16 890 case FL_STATUS:
^1da177e4c3f41 Linus Torvalds 2005-04-16 891 for (;;) {
4844ef80305d01 Vignesh Raghavendra 2019-06-25 892 if (chip_ready(map, chip, adr))
^1da177e4c3f41 Linus Torvalds 2005-04-16 893 break;
^1da177e4c3f41 Linus Torvalds 2005-04-16 894
^1da177e4c3f41 Linus Torvalds 2005-04-16 895 if (time_after(jiffies, timeo)) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 896 printk(KERN_ERR "Waiting for chip to be ready timed out.\n");
^1da177e4c3f41 Linus Torvalds 2005-04-16 897 return -EIO;
^1da177e4c3f41 Linus Torvalds 2005-04-16 898 }
c4e773764cead9 Stefani Seibold 2010-04-18 899 mutex_unlock(&chip->mutex);
^1da177e4c3f41 Linus Torvalds 2005-04-16 900 cfi_udelay(1);
c4e773764cead9 Stefani Seibold 2010-04-18 901 mutex_lock(&chip->mutex);
^1da177e4c3f41 Linus Torvalds 2005-04-16 902 /* Someone else might have been playing with it. */
^1da177e4c3f41 Linus Torvalds 2005-04-16 903 goto retry;
^1da177e4c3f41 Linus Torvalds 2005-04-16 904 }
19be9a9946b4bf Gustavo A. R. Silva 2020-10-08 905 break;
^1da177e4c3f41 Linus Torvalds 2005-04-16 906
^1da177e4c3f41 Linus Torvalds 2005-04-16 907 case FL_READY:
^1da177e4c3f41 Linus Torvalds 2005-04-16 908 case FL_CFI_QUERY:
^1da177e4c3f41 Linus Torvalds 2005-04-16 909 case FL_JEDEC_QUERY:
^1da177e4c3f41 Linus Torvalds 2005-04-16 910 return 0;
^1da177e4c3f41 Linus Torvalds 2005-04-16 911
^1da177e4c3f41 Linus Torvalds 2005-04-16 912 case FL_ERASING:
2695eab964efaa Joakim Tjernlund 2009-11-19 913 if (!cfip || !(cfip->EraseSuspend & (0x1|0x2)) ||
2695eab964efaa Joakim Tjernlund 2009-11-19 914 !(mode == FL_READY || mode == FL_POINT ||
2695eab964efaa Joakim Tjernlund 2009-11-19 915 (mode == FL_WRITING && (cfip->EraseSuspend & 0x2))))
^1da177e4c3f41 Linus Torvalds 2005-04-16 916 goto sleep;
^1da177e4c3f41 Linus Torvalds 2005-04-16 917
7b70eb14392a7c Joakim Tjernlund 2018-03-01 918 /* Do not allow suspend iff read/write to EB address */
7b70eb14392a7c Joakim Tjernlund 2018-03-01 919 if ((adr & chip->in_progress_block_mask) ==
7b70eb14392a7c Joakim Tjernlund 2018-03-01 920 chip->in_progress_block_addr)
7b70eb14392a7c Joakim Tjernlund 2018-03-01 921 goto sleep;
^1da177e4c3f41 Linus Torvalds 2005-04-16 922
^1da177e4c3f41 Linus Torvalds 2005-04-16 923 /* Erase suspend */
^1da177e4c3f41 Linus Torvalds 2005-04-16 924 /* It's harmless to issue the Erase-Suspend and Erase-Resume
^1da177e4c3f41 Linus Torvalds 2005-04-16 925 * commands when the erase algorithm isn't in progress. */
^1da177e4c3f41 Linus Torvalds 2005-04-16 926 map_write(map, CMD(0xB0), chip->in_progress_block_addr);
^1da177e4c3f41 Linus Torvalds 2005-04-16 927 chip->oldstate = FL_ERASING;
^1da177e4c3f41 Linus Torvalds 2005-04-16 928 chip->state = FL_ERASE_SUSPENDING;
^1da177e4c3f41 Linus Torvalds 2005-04-16 929 chip->erase_suspended = 1;
^1da177e4c3f41 Linus Torvalds 2005-04-16 930 for (;;) {
4844ef80305d01 Vignesh Raghavendra 2019-06-25 931 if (chip_ready(map, chip, adr))
^1da177e4c3f41 Linus Torvalds 2005-04-16 932 break;
^1da177e4c3f41 Linus Torvalds 2005-04-16 933
^1da177e4c3f41 Linus Torvalds 2005-04-16 934 if (time_after(jiffies, timeo)) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 935 /* Should have suspended the erase by now.
^1da177e4c3f41 Linus Torvalds 2005-04-16 936 * Send an Erase-Resume command as either
^1da177e4c3f41 Linus Torvalds 2005-04-16 937 * there was an error (so leave the erase
^1da177e4c3f41 Linus Torvalds 2005-04-16 938 * routine to recover from it) or we trying to
^1da177e4c3f41 Linus Torvalds 2005-04-16 939 * use the erase-in-progress sector. */
100f2341e305f9 Tadashi Abe 2011-05-19 940 put_chip(map, chip, adr);
^1da177e4c3f41 Linus Torvalds 2005-04-16 941 printk(KERN_ERR "MTD %s(): chip not ready after erase suspend\n", __func__);
^1da177e4c3f41 Linus Torvalds 2005-04-16 942 return -EIO;
^1da177e4c3f41 Linus Torvalds 2005-04-16 943 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 944
c4e773764cead9 Stefani Seibold 2010-04-18 945 mutex_unlock(&chip->mutex);
^1da177e4c3f41 Linus Torvalds 2005-04-16 946 cfi_udelay(1);
c4e773764cead9 Stefani Seibold 2010-04-18 947 mutex_lock(&chip->mutex);
^1da177e4c3f41 Linus Torvalds 2005-04-16 948 /* Nobody will touch it while it's in state FL_ERASE_SUSPENDING.
^1da177e4c3f41 Linus Torvalds 2005-04-16 949 So we can just loop here. */
^1da177e4c3f41 Linus Torvalds 2005-04-16 950 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 951 chip->state = FL_READY;
^1da177e4c3f41 Linus Torvalds 2005-04-16 952 return 0;
^1da177e4c3f41 Linus Torvalds 2005-04-16 953
02b15e343aeefb Todd Poynor 2005-06-07 954 case FL_XIP_WHILE_ERASING:
02b15e343aeefb Todd Poynor 2005-06-07 955 if (mode != FL_READY && mode != FL_POINT &&
02b15e343aeefb Todd Poynor 2005-06-07 956 (!cfip || !(cfip->EraseSuspend&2)))
02b15e343aeefb Todd Poynor 2005-06-07 957 goto sleep;
02b15e343aeefb Todd Poynor 2005-06-07 958 chip->oldstate = chip->state;
02b15e343aeefb Todd Poynor 2005-06-07 959 chip->state = FL_READY;
02b15e343aeefb Todd Poynor 2005-06-07 960 return 0;
02b15e343aeefb Todd Poynor 2005-06-07 961
eafe1311aa3cdb Kevin Cernekee 2010-04-29 962 case FL_SHUTDOWN:
eafe1311aa3cdb Kevin Cernekee 2010-04-29 963 /* The machine is rebooting */
eafe1311aa3cdb Kevin Cernekee 2010-04-29 964 return -EIO;
eafe1311aa3cdb Kevin Cernekee 2010-04-29 965
^1da177e4c3f41 Linus Torvalds 2005-04-16 966 case FL_POINT:
^1da177e4c3f41 Linus Torvalds 2005-04-16 967 /* Only if there's no operation suspended... */
^1da177e4c3f41 Linus Torvalds 2005-04-16 968 if (mode == FL_READY && chip->oldstate == FL_READY)
^1da177e4c3f41 Linus Torvalds 2005-04-16 969 return 0;
025a06c1104cd8 Miquel Raynal 2020-03-25 970 fallthrough;
^1da177e4c3f41 Linus Torvalds 2005-04-16 971 default:
^1da177e4c3f41 Linus Torvalds 2005-04-16 972 sleep:
^1da177e4c3f41 Linus Torvalds 2005-04-16 973 set_current_state(TASK_UNINTERRUPTIBLE);
^1da177e4c3f41 Linus Torvalds 2005-04-16 974 add_wait_queue(&chip->wq, &wait);
c4e773764cead9 Stefani Seibold 2010-04-18 975 mutex_unlock(&chip->mutex);
^1da177e4c3f41 Linus Torvalds 2005-04-16 976 schedule();
^1da177e4c3f41 Linus Torvalds 2005-04-16 977 remove_wait_queue(&chip->wq, &wait);
c4e773764cead9 Stefani Seibold 2010-04-18 978 mutex_lock(&chip->mutex);
^1da177e4c3f41 Linus Torvalds 2005-04-16 979 goto resettime;
^1da177e4c3f41 Linus Torvalds 2005-04-16 980 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 @981 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 982

:::::: The code at line 981 was first introduced by commit
:::::: 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 Linux-2.6.12-rc2

:::::: TO: Linus Torvalds <torvalds@xxxxxxxxxxxxxxx>
:::::: CC: Linus Torvalds <torvalds@xxxxxxxxxxxxxxx>

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

Attachment: .config.gz
Description: application/gzip