* [linux-next:master 1937/6910] drivers/mtd/nand/raw/qcom_nandc.c:2941 qcom_op_cmd_mapping() error: uninitialized symbol 'ret'.
@ 2023-08-03 12:20 Dan Carpenter
2023-08-04 16:45 ` Miquel Raynal
0 siblings, 1 reply; 14+ messages in thread
From: Dan Carpenter @ 2023-08-03 12:20 UTC (permalink / raw)
To: oe-kbuild, Md Sadre Alam
Cc: lkp, oe-kbuild-all, Linux Memory Management List, Miquel Raynal,
Sricharan Ramabadhran
tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head: fb4327106e5250ee360d0d8b056c1eef7eeb9a98
commit: 89550beb098e04b951df079483fb064eafc0e5fa [1937/6910] mtd: rawnand: qcom: Implement exec_op()
config: riscv-randconfig-m031-20230730 (https://download.01.org/0day-ci/archive/20230803/202308032022.SnXkKyFs-lkp@intel.com/config)
compiler: riscv64-linux-gcc (GCC) 12.3.0
reproduce: (https://download.01.org/0day-ci/archive/20230803/202308032022.SnXkKyFs-lkp@intel.com/reproduce)
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 <dan.carpenter@linaro.org>
| Closes: https://lore.kernel.org/r/202308032022.SnXkKyFs-lkp@intel.com/
New smatch warnings:
drivers/mtd/nand/raw/qcom_nandc.c:2941 qcom_op_cmd_mapping() error: uninitialized symbol 'ret'.
drivers/mtd/nand/raw/qcom_nandc.c:3369 qcom_check_op() warn: was && intended here instead of ||?
Old smatch warnings:
drivers/mtd/nand/raw/qcom_nandc.c:3076 qcom_read_status_exec() warn: inconsistent indenting
vim +/ret +2941 drivers/mtd/nand/raw/qcom_nandc.c
89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2909 static int qcom_op_cmd_mapping(struct qcom_nand_controller *nandc, u8 cmd,
89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2910 struct qcom_op *q_op)
89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2911 {
89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2912 int ret;
89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2913
89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2914 switch (cmd) {
89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2915 case NAND_CMD_RESET:
89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2916 ret = OP_RESET_DEVICE;
89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2917 break;
89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2918 case NAND_CMD_READID:
89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2919 ret = OP_FETCH_ID;
89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2920 break;
89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2921 case NAND_CMD_PARAM:
89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2922 if (nandc->props->qpic_v2)
89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2923 ret = OP_PAGE_READ_ONFI_READ;
89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2924 else
89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2925 ret = OP_PAGE_READ;
89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2926 break;
89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2927 case NAND_CMD_ERASE1:
89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2928 case NAND_CMD_ERASE2:
89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2929 ret = OP_BLOCK_ERASE;
89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2930 break;
89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2931 case NAND_CMD_STATUS:
89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2932 ret = OP_CHECK_STATUS;
89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2933 break;
89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2934 case NAND_CMD_PAGEPROG:
89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2935 ret = OP_PROGRAM_PAGE;
89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2936 q_op->flag = OP_PROGRAM_PAGE;
89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2937 nandc->exec_opwrite = true;
89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2938 break;
No default case. I'm more concerned about the && vs || warning, but
the zero day bot doesn't include that code into the email.
89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2939 }
89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2940
89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 @2941 return ret;
89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2942 }
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 14+ messages in thread* Re: [linux-next:master 1937/6910] drivers/mtd/nand/raw/qcom_nandc.c:2941 qcom_op_cmd_mapping() error: uninitialized symbol 'ret'. 2023-08-03 12:20 [linux-next:master 1937/6910] drivers/mtd/nand/raw/qcom_nandc.c:2941 qcom_op_cmd_mapping() error: uninitialized symbol 'ret' Dan Carpenter @ 2023-08-04 16:45 ` Miquel Raynal 2023-08-04 16:52 ` Dan Carpenter 0 siblings, 1 reply; 14+ messages in thread From: Miquel Raynal @ 2023-08-04 16:45 UTC (permalink / raw) To: Dan Carpenter Cc: oe-kbuild, Md Sadre Alam, lkp, oe-kbuild-all, Linux Memory Management List, Sricharan Ramabadhran, Manivannan Sadhasivam Hi Sadre, Sricharan & Manivannan, A couple of questions for you below. dan.carpenter@linaro.org wrote on Thu, 3 Aug 2023 15:20:56 +0300: > tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master > head: fb4327106e5250ee360d0d8b056c1eef7eeb9a98 > commit: 89550beb098e04b951df079483fb064eafc0e5fa [1937/6910] mtd: rawnand: qcom: Implement exec_op() > config: riscv-randconfig-m031-20230730 (https://download.01.org/0day-ci/archive/20230803/202308032022.SnXkKyFs-lkp@intel.com/config) > compiler: riscv64-linux-gcc (GCC) 12.3.0 > reproduce: (https://download.01.org/0day-ci/archive/20230803/202308032022.SnXkKyFs-lkp@intel.com/reproduce) > > 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 <dan.carpenter@linaro.org> > | Closes: https://lore.kernel.org/r/202308032022.SnXkKyFs-lkp@intel.com/ > > New smatch warnings: > drivers/mtd/nand/raw/qcom_nandc.c:2941 qcom_op_cmd_mapping() error: uninitialized symbol 'ret'. > drivers/mtd/nand/raw/qcom_nandc.c:3369 qcom_check_op() warn: was && intended here instead of ||? > > Old smatch warnings: > drivers/mtd/nand/raw/qcom_nandc.c:3076 qcom_read_status_exec() warn: inconsistent indenting > > vim +/ret +2941 drivers/mtd/nand/raw/qcom_nandc.c > > 89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2909 static int qcom_op_cmd_mapping(struct qcom_nand_controller *nandc, u8 cmd, > 89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2910 struct qcom_op *q_op) > 89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2911 { > 89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2912 int ret; > 89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2913 > 89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2914 switch (cmd) { > 89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2915 case NAND_CMD_RESET: > 89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2916 ret = OP_RESET_DEVICE; > 89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2917 break; > 89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2918 case NAND_CMD_READID: > 89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2919 ret = OP_FETCH_ID; > 89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2920 break; > 89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2921 case NAND_CMD_PARAM: > 89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2922 if (nandc->props->qpic_v2) > 89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2923 ret = OP_PAGE_READ_ONFI_READ; > 89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2924 else > 89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2925 ret = OP_PAGE_READ; > 89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2926 break; > 89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2927 case NAND_CMD_ERASE1: > 89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2928 case NAND_CMD_ERASE2: > 89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2929 ret = OP_BLOCK_ERASE; > 89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2930 break; > 89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2931 case NAND_CMD_STATUS: > 89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2932 ret = OP_CHECK_STATUS; > 89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2933 break; > 89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2934 case NAND_CMD_PAGEPROG: > 89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2935 ret = OP_PROGRAM_PAGE; > 89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2936 q_op->flag = OP_PROGRAM_PAGE; > 89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2937 nandc->exec_opwrite = true; > 89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2938 break; > > No default case. I'm more concerned about the && vs || warning, but > the zero day bot doesn't include that code into the email. The default case here is in theory not possible, as long as qcom_check_op() is properly implemented. We should however silence the warning by handling it. Maybe a WARN_ON_ONCE() + ret = <anything that will produce an error when executing the command> would work. However I doubt the following piece of code has been successfully tested: for (op_id = 0; op_id < op->ninstrs; op_id++) { instr = &op->instrs[op_id]; switch (instr->type) { case NAND_OP_CMD_INSTR: if (instr->ctx.cmd.opcode != NAND_CMD_RESET || instr->ctx.cmd.opcode != NAND_CMD_READID || instr->ctx.cmd.opcode != NAND_CMD_PARAM || instr->ctx.cmd.opcode != NAND_CMD_ERASE1 || instr->ctx.cmd.opcode != NAND_CMD_ERASE2 || instr->ctx.cmd.opcode != NAND_CMD_STATUS || instr->ctx.cmd.opcode != NAND_CMD_PAGEPROG) return -ENOTSUPP; break; The || should be &&, otherwise it cannot work, or am I missing something? Thanks, Miquèl ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [linux-next:master 1937/6910] drivers/mtd/nand/raw/qcom_nandc.c:2941 qcom_op_cmd_mapping() error: uninitialized symbol 'ret'. 2023-08-04 16:45 ` Miquel Raynal @ 2023-08-04 16:52 ` Dan Carpenter 2023-08-04 17:07 ` Miquel Raynal 0 siblings, 1 reply; 14+ messages in thread From: Dan Carpenter @ 2023-08-04 16:52 UTC (permalink / raw) To: Miquel Raynal Cc: oe-kbuild, Md Sadre Alam, lkp, oe-kbuild-all, Linux Memory Management List, Sricharan Ramabadhran, Manivannan Sadhasivam On Fri, Aug 04, 2023 at 06:45:50PM +0200, Miquel Raynal wrote: > Hi Sadre, Sricharan & Manivannan, > > A couple of questions for you below. > > dan.carpenter@linaro.org wrote on Thu, 3 Aug 2023 15:20:56 +0300: > > > tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master > > head: fb4327106e5250ee360d0d8b056c1eef7eeb9a98 > > commit: 89550beb098e04b951df079483fb064eafc0e5fa [1937/6910] mtd: rawnand: qcom: Implement exec_op() > > config: riscv-randconfig-m031-20230730 (https://download.01.org/0day-ci/archive/20230803/202308032022.SnXkKyFs-lkp@intel.com/config) > > compiler: riscv64-linux-gcc (GCC) 12.3.0 > > reproduce: (https://download.01.org/0day-ci/archive/20230803/202308032022.SnXkKyFs-lkp@intel.com/reproduce) > > > > 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 <dan.carpenter@linaro.org> > > | Closes: https://lore.kernel.org/r/202308032022.SnXkKyFs-lkp@intel.com/ > > > > New smatch warnings: > > drivers/mtd/nand/raw/qcom_nandc.c:2941 qcom_op_cmd_mapping() error: uninitialized symbol 'ret'. > > drivers/mtd/nand/raw/qcom_nandc.c:3369 qcom_check_op() warn: was && intended here instead of ||? > > > > Old smatch warnings: > > drivers/mtd/nand/raw/qcom_nandc.c:3076 qcom_read_status_exec() warn: inconsistent indenting > > > > vim +/ret +2941 drivers/mtd/nand/raw/qcom_nandc.c > > > > 89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2909 static int qcom_op_cmd_mapping(struct qcom_nand_controller *nandc, u8 cmd, > > 89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2910 struct qcom_op *q_op) > > 89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2911 { > > 89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2912 int ret; > > 89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2913 > > 89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2914 switch (cmd) { > > 89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2915 case NAND_CMD_RESET: > > 89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2916 ret = OP_RESET_DEVICE; > > 89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2917 break; > > 89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2918 case NAND_CMD_READID: > > 89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2919 ret = OP_FETCH_ID; > > 89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2920 break; > > 89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2921 case NAND_CMD_PARAM: > > 89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2922 if (nandc->props->qpic_v2) > > 89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2923 ret = OP_PAGE_READ_ONFI_READ; > > 89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2924 else > > 89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2925 ret = OP_PAGE_READ; > > 89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2926 break; > > 89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2927 case NAND_CMD_ERASE1: > > 89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2928 case NAND_CMD_ERASE2: > > 89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2929 ret = OP_BLOCK_ERASE; > > 89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2930 break; > > 89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2931 case NAND_CMD_STATUS: > > 89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2932 ret = OP_CHECK_STATUS; > > 89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2933 break; > > 89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2934 case NAND_CMD_PAGEPROG: > > 89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2935 ret = OP_PROGRAM_PAGE; > > 89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2936 q_op->flag = OP_PROGRAM_PAGE; > > 89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2937 nandc->exec_opwrite = true; > > 89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2938 break; > > > > No default case. I'm more concerned about the && vs || warning, but > > the zero day bot doesn't include that code into the email. > > The default case here is in theory not possible, as long as > qcom_check_op() is properly implemented. We should however silence the > warning by handling it. Maybe a WARN_ON_ONCE() + ret = <anything that > will produce an error when executing the command> would work. > The kbuild-bot runs without the cross function database so it has a lot of false positives that you wouldn't see if you had the DB. (There isn't really a way to build with the cross function DB. It takes way way way too long. Also it sometimes finds bug which are complicated to explain or to assign blame for in an automated way). But these false positives are frustrating to me. In real life, GCC is going to automatically initialize stack variables to zero on production systems. > However I doubt the following piece of code has been successfully > tested: > > for (op_id = 0; op_id < op->ninstrs; op_id++) { > instr = &op->instrs[op_id]; > > switch (instr->type) { > case NAND_OP_CMD_INSTR: > if (instr->ctx.cmd.opcode != NAND_CMD_RESET || > instr->ctx.cmd.opcode != NAND_CMD_READID || > instr->ctx.cmd.opcode != NAND_CMD_PARAM || > instr->ctx.cmd.opcode != NAND_CMD_ERASE1 || > instr->ctx.cmd.opcode != NAND_CMD_ERASE2 || > instr->ctx.cmd.opcode != NAND_CMD_STATUS || > instr->ctx.cmd.opcode != NAND_CMD_PAGEPROG) > return -ENOTSUPP; > break; > > The || should be &&, otherwise it cannot work, or am I missing > something? Yeah. That's how this bug normally looks like. NAND_OP_CMD_INSTR always returns -ENOTSUPP. regards, dan carpenter ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [linux-next:master 1937/6910] drivers/mtd/nand/raw/qcom_nandc.c:2941 qcom_op_cmd_mapping() error: uninitialized symbol 'ret'. 2023-08-04 16:52 ` Dan Carpenter @ 2023-08-04 17:07 ` Miquel Raynal 2023-08-05 6:55 ` Manivannan Sadhasivam 0 siblings, 1 reply; 14+ messages in thread From: Miquel Raynal @ 2023-08-04 17:07 UTC (permalink / raw) To: Dan Carpenter Cc: oe-kbuild, Md Sadre Alam, lkp, oe-kbuild-all, Linux Memory Management List, Sricharan Ramabadhran, Manivannan Sadhasivam Hi Dan, dan.carpenter@linaro.org wrote on Fri, 4 Aug 2023 19:52:50 +0300: > On Fri, Aug 04, 2023 at 06:45:50PM +0200, Miquel Raynal wrote: > > Hi Sadre, Sricharan & Manivannan, > > > > A couple of questions for you below. > > > > dan.carpenter@linaro.org wrote on Thu, 3 Aug 2023 15:20:56 +0300: > > > > > tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master > > > head: fb4327106e5250ee360d0d8b056c1eef7eeb9a98 > > > commit: 89550beb098e04b951df079483fb064eafc0e5fa [1937/6910] mtd: rawnand: qcom: Implement exec_op() > > > config: riscv-randconfig-m031-20230730 (https://download.01.org/0day-ci/archive/20230803/202308032022.SnXkKyFs-lkp@intel.com/config) > > > compiler: riscv64-linux-gcc (GCC) 12.3.0 > > > reproduce: (https://download.01.org/0day-ci/archive/20230803/202308032022.SnXkKyFs-lkp@intel.com/reproduce) > > > > > > 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 <dan.carpenter@linaro.org> > > > | Closes: https://lore.kernel.org/r/202308032022.SnXkKyFs-lkp@intel.com/ > > > > > > New smatch warnings: > > > drivers/mtd/nand/raw/qcom_nandc.c:2941 qcom_op_cmd_mapping() error: uninitialized symbol 'ret'. > > > drivers/mtd/nand/raw/qcom_nandc.c:3369 qcom_check_op() warn: was && intended here instead of ||? > > > > > > Old smatch warnings: > > > drivers/mtd/nand/raw/qcom_nandc.c:3076 qcom_read_status_exec() warn: inconsistent indenting > > > > > > vim +/ret +2941 drivers/mtd/nand/raw/qcom_nandc.c > > > > > > 89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2909 static int qcom_op_cmd_mapping(struct qcom_nand_controller *nandc, u8 cmd, > > > 89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2910 struct qcom_op *q_op) > > > 89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2911 { > > > 89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2912 int ret; > > > 89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2913 > > > 89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2914 switch (cmd) { > > > 89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2915 case NAND_CMD_RESET: > > > 89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2916 ret = OP_RESET_DEVICE; > > > 89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2917 break; > > > 89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2918 case NAND_CMD_READID: > > > 89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2919 ret = OP_FETCH_ID; > > > 89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2920 break; > > > 89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2921 case NAND_CMD_PARAM: > > > 89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2922 if (nandc->props->qpic_v2) > > > 89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2923 ret = OP_PAGE_READ_ONFI_READ; > > > 89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2924 else > > > 89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2925 ret = OP_PAGE_READ; > > > 89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2926 break; > > > 89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2927 case NAND_CMD_ERASE1: > > > 89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2928 case NAND_CMD_ERASE2: > > > 89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2929 ret = OP_BLOCK_ERASE; > > > 89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2930 break; > > > 89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2931 case NAND_CMD_STATUS: > > > 89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2932 ret = OP_CHECK_STATUS; > > > 89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2933 break; > > > 89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2934 case NAND_CMD_PAGEPROG: > > > 89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2935 ret = OP_PROGRAM_PAGE; > > > 89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2936 q_op->flag = OP_PROGRAM_PAGE; > > > 89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2937 nandc->exec_opwrite = true; > > > 89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2938 break; > > > > > > No default case. I'm more concerned about the && vs || warning, but > > > the zero day bot doesn't include that code into the email. > > > > The default case here is in theory not possible, as long as > > qcom_check_op() is properly implemented. We should however silence the > > warning by handling it. Maybe a WARN_ON_ONCE() + ret = <anything that > > will produce an error when executing the command> would work. > > > > The kbuild-bot runs without the cross function database so it has a lot > of false positives that you wouldn't see if you had the DB. (There > isn't really a way to build with the cross function DB. It takes way > way way too long. Also it sometimes finds bug which are complicated to > explain or to assign blame for in an automated way). But these false > positives are frustrating to me. I understand. > In real life, GCC is going to automatically initialize stack variables > to zero on production systems. Well, we must silence this by setting reg in all cases, but here the variable is badly named, it should be s/ret/cmd/. That's why, if we silence it properly, I would go for a runtime warning if we ever encounter the situation because this is a purely software bug. > > However I doubt the following piece of code has been successfully > > tested: > > > > for (op_id = 0; op_id < op->ninstrs; op_id++) { > > instr = &op->instrs[op_id]; > > > > switch (instr->type) { > > case NAND_OP_CMD_INSTR: > > if (instr->ctx.cmd.opcode != NAND_CMD_RESET || > > instr->ctx.cmd.opcode != NAND_CMD_READID || > > instr->ctx.cmd.opcode != NAND_CMD_PARAM || > > instr->ctx.cmd.opcode != NAND_CMD_ERASE1 || > > instr->ctx.cmd.opcode != NAND_CMD_ERASE2 || > > instr->ctx.cmd.opcode != NAND_CMD_STATUS || > > instr->ctx.cmd.opcode != NAND_CMD_PAGEPROG) > > return -ENOTSUPP; > > break; > > > > The || should be &&, otherwise it cannot work, or am I missing > > something? > > Yeah. That's how this bug normally looks like. NAND_OP_CMD_INSTR > always returns -ENOTSUPP. > > regards, > dan carpenter > Thanks, Miquèl ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [linux-next:master 1937/6910] drivers/mtd/nand/raw/qcom_nandc.c:2941 qcom_op_cmd_mapping() error: uninitialized symbol 'ret'. 2023-08-04 17:07 ` Miquel Raynal @ 2023-08-05 6:55 ` Manivannan Sadhasivam 2023-08-06 7:58 ` Sricharan Ramabadhran 0 siblings, 1 reply; 14+ messages in thread From: Manivannan Sadhasivam @ 2023-08-05 6:55 UTC (permalink / raw) To: Miquel Raynal Cc: Dan Carpenter, oe-kbuild, Md Sadre Alam, lkp, oe-kbuild-all, Linux Memory Management List, Sricharan Ramabadhran On Fri, Aug 04, 2023 at 07:07:50PM +0200, Miquel Raynal wrote: > Hi Dan, > > dan.carpenter@linaro.org wrote on Fri, 4 Aug 2023 19:52:50 +0300: > > > On Fri, Aug 04, 2023 at 06:45:50PM +0200, Miquel Raynal wrote: > > > Hi Sadre, Sricharan & Manivannan, > > > > > > A couple of questions for you below. > > > > > > dan.carpenter@linaro.org wrote on Thu, 3 Aug 2023 15:20:56 +0300: > > > > > > > tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master > > > > head: fb4327106e5250ee360d0d8b056c1eef7eeb9a98 > > > > commit: 89550beb098e04b951df079483fb064eafc0e5fa [1937/6910] mtd: rawnand: qcom: Implement exec_op() > > > > config: riscv-randconfig-m031-20230730 (https://download.01.org/0day-ci/archive/20230803/202308032022.SnXkKyFs-lkp@intel.com/config) > > > > compiler: riscv64-linux-gcc (GCC) 12.3.0 > > > > reproduce: (https://download.01.org/0day-ci/archive/20230803/202308032022.SnXkKyFs-lkp@intel.com/reproduce) > > > > > > > > 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 <dan.carpenter@linaro.org> > > > > | Closes: https://lore.kernel.org/r/202308032022.SnXkKyFs-lkp@intel.com/ > > > > > > > > New smatch warnings: > > > > drivers/mtd/nand/raw/qcom_nandc.c:2941 qcom_op_cmd_mapping() error: uninitialized symbol 'ret'. > > > > drivers/mtd/nand/raw/qcom_nandc.c:3369 qcom_check_op() warn: was && intended here instead of ||? > > > > > > > > Old smatch warnings: > > > > drivers/mtd/nand/raw/qcom_nandc.c:3076 qcom_read_status_exec() warn: inconsistent indenting > > > > > > > > vim +/ret +2941 drivers/mtd/nand/raw/qcom_nandc.c > > > > > > > > 89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2909 static int qcom_op_cmd_mapping(struct qcom_nand_controller *nandc, u8 cmd, > > > > 89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2910 struct qcom_op *q_op) > > > > 89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2911 { > > > > 89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2912 int ret; > > > > 89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2913 > > > > 89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2914 switch (cmd) { > > > > 89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2915 case NAND_CMD_RESET: > > > > 89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2916 ret = OP_RESET_DEVICE; > > > > 89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2917 break; > > > > 89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2918 case NAND_CMD_READID: > > > > 89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2919 ret = OP_FETCH_ID; > > > > 89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2920 break; > > > > 89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2921 case NAND_CMD_PARAM: > > > > 89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2922 if (nandc->props->qpic_v2) > > > > 89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2923 ret = OP_PAGE_READ_ONFI_READ; > > > > 89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2924 else > > > > 89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2925 ret = OP_PAGE_READ; > > > > 89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2926 break; > > > > 89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2927 case NAND_CMD_ERASE1: > > > > 89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2928 case NAND_CMD_ERASE2: > > > > 89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2929 ret = OP_BLOCK_ERASE; > > > > 89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2930 break; > > > > 89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2931 case NAND_CMD_STATUS: > > > > 89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2932 ret = OP_CHECK_STATUS; > > > > 89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2933 break; > > > > 89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2934 case NAND_CMD_PAGEPROG: > > > > 89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2935 ret = OP_PROGRAM_PAGE; > > > > 89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2936 q_op->flag = OP_PROGRAM_PAGE; > > > > 89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2937 nandc->exec_opwrite = true; > > > > 89550beb098e04 drivers/mtd/nand/raw/qcom_nandc.c Md Sadre Alam 2023-07-10 2938 break; > > > > > > > > No default case. I'm more concerned about the && vs || warning, but > > > > the zero day bot doesn't include that code into the email. > > > > > > The default case here is in theory not possible, as long as > > > qcom_check_op() is properly implemented. We should however silence the > > > warning by handling it. Maybe a WARN_ON_ONCE() + ret = <anything that > > > will produce an error when executing the command> would work. > > > > > > > The kbuild-bot runs without the cross function database so it has a lot > > of false positives that you wouldn't see if you had the DB. (There > > isn't really a way to build with the cross function DB. It takes way > > way way too long. Also it sometimes finds bug which are complicated to > > explain or to assign blame for in an automated way). But these false > > positives are frustrating to me. > > I understand. > > > In real life, GCC is going to automatically initialize stack variables > > to zero on production systems. > > Well, we must silence this by setting reg in all cases, but here the > variable is badly named, it should be s/ret/cmd/. That's why, if we > silence it properly, I would go for a runtime warning if we ever > encounter the situation because this is a purely software bug. > I agree, it is better to add a default case for sanity. Regarding the variable naming, I agree it should be improved. Something like, s/cmd/opcode s/ret/cmd Also, I do not want to add WARN_ON_ONCE() here, but rather a dev_err(). > > > However I doubt the following piece of code has been successfully > > > tested: > > > > > > for (op_id = 0; op_id < op->ninstrs; op_id++) { > > > instr = &op->instrs[op_id]; > > > > > > switch (instr->type) { > > > case NAND_OP_CMD_INSTR: > > > if (instr->ctx.cmd.opcode != NAND_CMD_RESET || > > > instr->ctx.cmd.opcode != NAND_CMD_READID || > > > instr->ctx.cmd.opcode != NAND_CMD_PARAM || > > > instr->ctx.cmd.opcode != NAND_CMD_ERASE1 || > > > instr->ctx.cmd.opcode != NAND_CMD_ERASE2 || > > > instr->ctx.cmd.opcode != NAND_CMD_STATUS || > > > instr->ctx.cmd.opcode != NAND_CMD_PAGEPROG) > > > return -ENOTSUPP; > > > break; > > > > > > The || should be &&, otherwise it cannot work, or am I missing > > > something? > > > > Yeah. That's how this bug normally looks like. NAND_OP_CMD_INSTR > > always returns -ENOTSUPP. > > Yes, this is a bug. I didn't get a chance to review the exec_op conversion series (blame myself). Now I see scope for a cleaup series :/ Let me spin something by the end of today. - Mani > > regards, > > dan carpenter > > > > > Thanks, > Miquèl -- மணிவண்ணன் சதாசிவம் ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [linux-next:master 1937/6910] drivers/mtd/nand/raw/qcom_nandc.c:2941 qcom_op_cmd_mapping() error: uninitialized symbol 'ret'. 2023-08-05 6:55 ` Manivannan Sadhasivam @ 2023-08-06 7:58 ` Sricharan Ramabadhran 2023-08-07 18:54 ` Sricharan Ramabadhran 0 siblings, 1 reply; 14+ messages in thread From: Sricharan Ramabadhran @ 2023-08-06 7:58 UTC (permalink / raw) To: Manivannan Sadhasivam, Miquel Raynal Cc: Dan Carpenter, oe-kbuild, Md Sadre Alam, lkp, oe-kbuild-all, Linux Memory Management List Hi Miquel/Mani/Dan, <..> >>>> The || should be &&, otherwise it cannot work, or am I missing >>>> something? >>> >>> Yeah. That's how this bug normally looks like. NAND_OP_CMD_INSTR >>> always returns -ENOTSUPP. >>> > > Yes, this is a bug. > > I didn't get a chance to review the exec_op conversion series (blame myself). > Now I see scope for a cleaup series :/ > > Let me spin something by the end of today. > Thanks a lot Mani for the quick fixes. Will test it. Sorry it was a holiday for us past few days, so just checked this. Regards, Sricharan ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [linux-next:master 1937/6910] drivers/mtd/nand/raw/qcom_nandc.c:2941 qcom_op_cmd_mapping() error: uninitialized symbol 'ret'. 2023-08-06 7:58 ` Sricharan Ramabadhran @ 2023-08-07 18:54 ` Sricharan Ramabadhran 2023-08-07 19:14 ` Miquel Raynal 0 siblings, 1 reply; 14+ messages in thread From: Sricharan Ramabadhran @ 2023-08-07 18:54 UTC (permalink / raw) To: Manivannan Sadhasivam, Miquel Raynal Cc: Dan Carpenter, oe-kbuild, Md Sadre Alam, lkp, oe-kbuild-all, Linux Memory Management List Hi Mani/Miquel, On 8/6/2023 1:28 PM, Sricharan Ramabadhran wrote: > Hi Miquel/Mani/Dan, > > <..> > >>>>> The || should be &&, otherwise it cannot work, or am I missing >>>>> something? >>>> >>>> Yeah. That's how this bug normally looks like. NAND_OP_CMD_INSTR >>>> always returns -ENOTSUPP. >>>> >> >> Yes, this is a bug. >> >> I didn't get a chance to review the exec_op conversion series (blame >> myself). >> Now I see scope for a cleaup series :/ >> >> Let me spin something by the end of today. >> > Thanks a lot Mani for the quick fixes. Will test it. > Sorry it was a holiday for us past few days, so just checked this. > > Regards, > Sricharan With this series applied on linux-next, started seeing the below messages flooded on console while doing mtd r/w. "xxx "Opcode not supported: 0" opcode '0' corresponds to NAND_CMD_READ0. This command inturn was invoked from qcom_nandc.c driver from below places. For read/write_page driver does not use the exec ops. Hence these calls just ends up being -ENOTSUPP and ignored. So removed their invocations. If this is fine, can this be added to your series ? (will send git-format patch to add to your cleanup series). So far, tested mtd raw/block read/writes and all works fine. Will do further tests as well. --- a/drivers/mtd/nand/raw/qcom_nandc.c +++ b/drivers/mtd/nand/raw/qcom_nandc.c @@ -1470,7 +1470,6 @@ qcom_nandc_read_cw_raw(struct mtd_info *mtd, struct nand_chip *chip, int ret, reg_off = FLASH_BUF_ACC, read_loc = 0; int raw_cw = cw; - nand_read_page_op(chip, page, 0, NULL, 0); host->use_ecc = false; if (nandc->props->qpic_v2) @@ -1890,7 +1889,6 @@ static int qcom_nandc_read_page(struct nand_chip *chip, u8 *buf, if (host->nr_boot_partitions) qcom_nandc_codeword_fixup(host, page); - nand_read_page_op(chip, page, 0, NULL, 0); nandc->buf_count = 0; nandc->buf_start = 0; host->use_ecc = true; @@ -1965,8 +1963,6 @@ static int qcom_nandc_write_page(struct nand_chip *chip, const u8 *buf, if (host->nr_boot_partitions) qcom_nandc_codeword_fixup(host, page); - nand_prog_page_begin_op(chip, page, 0, NULL, 0); - set_address(host, 0, page); nandc->buf_count = 0; nandc->buf_start = 0; @@ -2039,7 +2035,6 @@ static int qcom_nandc_write_page_raw(struct nand_chip *chip, if (host->nr_boot_partitions) qcom_nandc_codeword_fixup(host, page); - nand_prog_page_begin_op(chip, page, 0, NULL, 0); clear_read_regs(nandc); clear_bam_transaction(nandc); Regards, Sricharan ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [linux-next:master 1937/6910] drivers/mtd/nand/raw/qcom_nandc.c:2941 qcom_op_cmd_mapping() error: uninitialized symbol 'ret'. 2023-08-07 18:54 ` Sricharan Ramabadhran @ 2023-08-07 19:14 ` Miquel Raynal 2023-08-08 5:16 ` Sricharan Ramabadhran 0 siblings, 1 reply; 14+ messages in thread From: Miquel Raynal @ 2023-08-07 19:14 UTC (permalink / raw) To: Sricharan Ramabadhran Cc: Manivannan Sadhasivam, Dan Carpenter, oe-kbuild, Md Sadre Alam, lkp, oe-kbuild-all, Linux Memory Management List Hi Sricharan, quic_srichara@quicinc.com wrote on Tue, 8 Aug 2023 00:24:08 +0530: > Hi Mani/Miquel, > > On 8/6/2023 1:28 PM, Sricharan Ramabadhran wrote: > > Hi Miquel/Mani/Dan, > > > > <..> > > > >>>>> The || should be &&, otherwise it cannot work, or am I missing > >>>>> something? > >>>> > >>>> Yeah. That's how this bug normally looks like. NAND_OP_CMD_INSTR > >>>> always returns -ENOTSUPP. > >>>> > >> > >> Yes, this is a bug. > >> > >> I didn't get a chance to review the exec_op conversion series (blame >> myself). > >> Now I see scope for a cleaup series :/ > >> > >> Let me spin something by the end of today. > >> > > Thanks a lot Mani for the quick fixes. Will test it. > > Sorry it was a holiday for us past few days, so just checked this. > > > > Regards, > > Sricharan > > With this series applied on linux-next, started seeing the below > messages flooded on console while doing mtd r/w. > "xxx "Opcode not supported: 0" > > opcode '0' corresponds to NAND_CMD_READ0. This command inturn was > invoked from qcom_nandc.c driver from below places. For read/write_page > driver does not use the exec ops. Hence these calls just ends up > being -ENOTSUPP and ignored. So removed their invocations. > If this is fine, can this be added to your series ? (will send > git-format patch to add to your cleanup series). So far, tested > mtd raw/block read/writes and all works fine. Will do further tests > as well. Unless I really don't understand the controller, this is non sense. nand_read_page_op() is precisely what allows your NAND to perform a read. Removing this call cannot work. What you need is a proper ->exec_op() implementation, and repeating this becomes slightly annoying. Look at your qcom_op_cmd_mapping, you don't even have a path for reads. I bet something along: CMD_READ0: ret = XXX_OPCODE_READ; break; will make it work. Please fix the driver and test with nandbiterrs -i. If this test works, it is encouraging. Otherwise it is still broken. > --- a/drivers/mtd/nand/raw/qcom_nandc.c > +++ b/drivers/mtd/nand/raw/qcom_nandc.c > @@ -1470,7 +1470,6 @@ qcom_nandc_read_cw_raw(struct mtd_info *mtd, struct nand_chip *chip, > int ret, reg_off = FLASH_BUF_ACC, read_loc = 0; > int raw_cw = cw; > > - nand_read_page_op(chip, page, 0, NULL, 0); > host->use_ecc = false; > > if (nandc->props->qpic_v2) > @@ -1890,7 +1889,6 @@ static int qcom_nandc_read_page(struct nand_chip *chip, u8 *buf, > if (host->nr_boot_partitions) > qcom_nandc_codeword_fixup(host, page); > > - nand_read_page_op(chip, page, 0, NULL, 0); > nandc->buf_count = 0; > nandc->buf_start = 0; > host->use_ecc = true; > @@ -1965,8 +1963,6 @@ static int qcom_nandc_write_page(struct nand_chip *chip, const u8 *buf, > if (host->nr_boot_partitions) > qcom_nandc_codeword_fixup(host, page); > > - nand_prog_page_begin_op(chip, page, 0, NULL, 0); > - > set_address(host, 0, page); > nandc->buf_count = 0; > nandc->buf_start = 0; > @@ -2039,7 +2035,6 @@ static int qcom_nandc_write_page_raw(struct nand_chip *chip, > if (host->nr_boot_partitions) > qcom_nandc_codeword_fixup(host, page); > > - nand_prog_page_begin_op(chip, page, 0, NULL, 0); > clear_read_regs(nandc); > clear_bam_transaction(nandc); > > > Regards, > Sricharan Miquèl ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [linux-next:master 1937/6910] drivers/mtd/nand/raw/qcom_nandc.c:2941 qcom_op_cmd_mapping() error: uninitialized symbol 'ret'. 2023-08-07 19:14 ` Miquel Raynal @ 2023-08-08 5:16 ` Sricharan Ramabadhran 2023-08-18 13:33 ` Miquel Raynal 0 siblings, 1 reply; 14+ messages in thread From: Sricharan Ramabadhran @ 2023-08-08 5:16 UTC (permalink / raw) To: Miquel Raynal Cc: Manivannan Sadhasivam, Dan Carpenter, oe-kbuild, Md Sadre Alam, lkp, oe-kbuild-all, Linux Memory Management List <..> >> With this series applied on linux-next, started seeing the below >> messages flooded on console while doing mtd r/w. >> "xxx "Opcode not supported: 0" >> >> opcode '0' corresponds to NAND_CMD_READ0. This command inturn was >> invoked from qcom_nandc.c driver from below places. For read/write_page >> driver does not use the exec ops. Hence these calls just ends up >> being -ENOTSUPP and ignored. So removed their invocations. >> If this is fine, can this be added to your series ? (will send >> git-format patch to add to your cleanup series). So far, tested >> mtd raw/block read/writes and all works fine. Will do further tests >> as well. > > Unless I really don't understand the controller, this is non sense. > nand_read_page_op() is precisely what allows your NAND to perform a > read. Removing this call cannot work. > > What you need is a proper ->exec_op() implementation, and repeating > this becomes slightly annoying. > > Look at your qcom_op_cmd_mapping, you don't even have a path for reads. > I bet something along: > CMD_READ0: > ret = XXX_OPCODE_READ; > break; > will make it work. > > Please fix the driver and test with nandbiterrs -i. If this test works, > it is encouraging. Otherwise it is still broken. ok understand. Will fix this up. Regards, Sricharan ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [linux-next:master 1937/6910] drivers/mtd/nand/raw/qcom_nandc.c:2941 qcom_op_cmd_mapping() error: uninitialized symbol 'ret'. 2023-08-08 5:16 ` Sricharan Ramabadhran @ 2023-08-18 13:33 ` Miquel Raynal 2023-08-18 13:51 ` Sricharan Ramabadhran 0 siblings, 1 reply; 14+ messages in thread From: Miquel Raynal @ 2023-08-18 13:33 UTC (permalink / raw) To: Sricharan Ramabadhran Cc: Manivannan Sadhasivam, Dan Carpenter, oe-kbuild, Md Sadre Alam, lkp, oe-kbuild-all, Linux Memory Management List Hi Sricharan, quic_srichara@quicinc.com wrote on Tue, 8 Aug 2023 10:46:14 +0530: > <..> > > >> With this series applied on linux-next, started seeing the below > >> messages flooded on console while doing mtd r/w. > >> "xxx "Opcode not supported: 0" > >> > >> opcode '0' corresponds to NAND_CMD_READ0. This command inturn was > >> invoked from qcom_nandc.c driver from below places. For read/write_page > >> driver does not use the exec ops. Hence these calls just ends up > >> being -ENOTSUPP and ignored. So removed their invocations. > >> If this is fine, can this be added to your series ? (will send > >> git-format patch to add to your cleanup series). So far, tested > >> mtd raw/block read/writes and all works fine. Will do further tests > >> as well. > > > > Unless I really don't understand the controller, this is non sense. > > nand_read_page_op() is precisely what allows your NAND to perform a > > read. Removing this call cannot work. > > > > What you need is a proper ->exec_op() implementation, and repeating > > this becomes slightly annoying. > > > > Look at your qcom_op_cmd_mapping, you don't even have a path for reads. > > I bet something along: > > CMD_READ0: > > ret = XXX_OPCODE_READ; > > break; > > will make it work. > > > > Please fix the driver and test with nandbiterrs -i. If this test works, > > it is encouraging. Otherwise it is still broken. > > ok understand. Will fix this up. This is urgent now. The driver in -next is broken, shall I revert everything or will you test the above fix quickly? Thanks, Miquèl ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [linux-next:master 1937/6910] drivers/mtd/nand/raw/qcom_nandc.c:2941 qcom_op_cmd_mapping() error: uninitialized symbol 'ret'. 2023-08-18 13:33 ` Miquel Raynal @ 2023-08-18 13:51 ` Sricharan Ramabadhran 2023-08-18 14:03 ` Miquel Raynal 0 siblings, 1 reply; 14+ messages in thread From: Sricharan Ramabadhran @ 2023-08-18 13:51 UTC (permalink / raw) To: Miquel Raynal Cc: Manivannan Sadhasivam, Dan Carpenter, oe-kbuild, Md Sadre Alam, lkp, oe-kbuild-all, Linux Memory Management List Hi Miquel, On 8/18/2023 7:03 PM, Miquel Raynal wrote: > Hi Sricharan, > > quic_srichara@quicinc.com wrote on Tue, 8 Aug 2023 10:46:14 +0530: > >> <..> >> >>>> With this series applied on linux-next, started seeing the below >>>> messages flooded on console while doing mtd r/w. >>>> "xxx "Opcode not supported: 0" >>>> >>>> opcode '0' corresponds to NAND_CMD_READ0. This command inturn was >>>> invoked from qcom_nandc.c driver from below places. For read/write_page >>>> driver does not use the exec ops. Hence these calls just ends up >>>> being -ENOTSUPP and ignored. So removed their invocations. >>>> If this is fine, can this be added to your series ? (will send >>>> git-format patch to add to your cleanup series). So far, tested >>>> mtd raw/block read/writes and all works fine. Will do further tests >>>> as well. >>> >>> Unless I really don't understand the controller, this is non sense. >>> nand_read_page_op() is precisely what allows your NAND to perform a >>> read. Removing this call cannot work. >>> >>> What you need is a proper ->exec_op() implementation, and repeating >>> this becomes slightly annoying. >>> >>> Look at your qcom_op_cmd_mapping, you don't even have a path for reads. >>> I bet something along: >>> CMD_READ0: >>> ret = XXX_OPCODE_READ; >>> break; >>> will make it work. >>> >>> Please fix the driver and test with nandbiterrs -i. If this test works, >>> it is encouraging. Otherwise it is still broken. >> >> ok understand. Will fix this up. > > This is urgent now. The driver in -next is broken, shall I revert > everything or will you test the above fix quickly? > While we are able to reproduce the issue, add path for CMD_READ0/READ_START for IPQ platforms. All mtd tests including nandbiterrs works fine. But we are not able to get hold of a SDX device where we could reproduce the issue to debug. We are working offline with Manivannan for the SDX remote debug. Will keep you updated here and if we are not able to solve this on SDX in next couple of days, only way looks like revert and re-apply it for 6.7. Regards, Sricharan ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [linux-next:master 1937/6910] drivers/mtd/nand/raw/qcom_nandc.c:2941 qcom_op_cmd_mapping() error: uninitialized symbol 'ret'. 2023-08-18 13:51 ` Sricharan Ramabadhran @ 2023-08-18 14:03 ` Miquel Raynal 2023-08-18 14:17 ` Sricharan Ramabadhran 0 siblings, 1 reply; 14+ messages in thread From: Miquel Raynal @ 2023-08-18 14:03 UTC (permalink / raw) To: Sricharan Ramabadhran Cc: Manivannan Sadhasivam, Dan Carpenter, oe-kbuild, Md Sadre Alam, lkp, oe-kbuild-all, Linux Memory Management List Hi Sricharan, quic_srichara@quicinc.com wrote on Fri, 18 Aug 2023 19:21:04 +0530: > Hi Miquel, > > On 8/18/2023 7:03 PM, Miquel Raynal wrote: > > Hi Sricharan, > > > > quic_srichara@quicinc.com wrote on Tue, 8 Aug 2023 10:46:14 +0530: > > > >> <..> > >> > >>>> With this series applied on linux-next, started seeing the below > >>>> messages flooded on console while doing mtd r/w. > >>>> "xxx "Opcode not supported: 0" > >>>> > >>>> opcode '0' corresponds to NAND_CMD_READ0. This command inturn was > >>>> invoked from qcom_nandc.c driver from below places. For read/write_page > >>>> driver does not use the exec ops. Hence these calls just ends up > >>>> being -ENOTSUPP and ignored. So removed their invocations. > >>>> If this is fine, can this be added to your series ? (will send > >>>> git-format patch to add to your cleanup series). So far, tested > >>>> mtd raw/block read/writes and all works fine. Will do further tests > >>>> as well. > >>> > >>> Unless I really don't understand the controller, this is non sense. > >>> nand_read_page_op() is precisely what allows your NAND to perform a > >>> read. Removing this call cannot work. > >>> > >>> What you need is a proper ->exec_op() implementation, and repeating > >>> this becomes slightly annoying. > >>> > >>> Look at your qcom_op_cmd_mapping, you don't even have a path for reads. > >>> I bet something along: > >>> CMD_READ0: > >>> ret = XXX_OPCODE_READ; > >>> break; > >>> will make it work. > >>> > >>> Please fix the driver and test with nandbiterrs -i. If this test works, > >>> it is encouraging. Otherwise it is still broken. > >> > >> ok understand. Will fix this up. > > > > This is urgent now. The driver in -next is broken, shall I revert > > everything or will you test the above fix quickly? > > > > While we are able to reproduce the issue, add path for > CMD_READ0/READ_START for IPQ platforms. All mtd tests including > nandbiterrs works fine. But we are not able to get hold of a SDX > device where we could reproduce the issue to debug. We are working > offline with Manivannan for the SDX remote debug. Will keep you > updated here and if we are not able to solve this on SDX in next > couple of days, only way looks like revert and re-apply it for 6.7. If the READ path works on IPQ platforms it's already a huge step forward, please send the fix on top of Mannivan series. Now, what is the issue with SDX? Thanks, Miquèl ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [linux-next:master 1937/6910] drivers/mtd/nand/raw/qcom_nandc.c:2941 qcom_op_cmd_mapping() error: uninitialized symbol 'ret'. 2023-08-18 14:03 ` Miquel Raynal @ 2023-08-18 14:17 ` Sricharan Ramabadhran 2023-08-18 15:24 ` Sricharan Ramabadhran 0 siblings, 1 reply; 14+ messages in thread From: Sricharan Ramabadhran @ 2023-08-18 14:17 UTC (permalink / raw) To: Miquel Raynal Cc: Manivannan Sadhasivam, Dan Carpenter, oe-kbuild, Md Sadre Alam, lkp, oe-kbuild-all, Linux Memory Management List On 8/18/2023 7:33 PM, Miquel Raynal wrote: > Hi Sricharan, > > quic_srichara@quicinc.com wrote on Fri, 18 Aug 2023 19:21:04 +0530: > >> Hi Miquel, >> >> On 8/18/2023 7:03 PM, Miquel Raynal wrote: >>> Hi Sricharan, >>> >>> quic_srichara@quicinc.com wrote on Tue, 8 Aug 2023 10:46:14 +0530: >>> >>>> <..> >>>> >>>>>> With this series applied on linux-next, started seeing the below >>>>>> messages flooded on console while doing mtd r/w. >>>>>> "xxx "Opcode not supported: 0" >>>>>> >>>>>> opcode '0' corresponds to NAND_CMD_READ0. This command inturn was >>>>>> invoked from qcom_nandc.c driver from below places. For read/write_page >>>>>> driver does not use the exec ops. Hence these calls just ends up >>>>>> being -ENOTSUPP and ignored. So removed their invocations. >>>>>> If this is fine, can this be added to your series ? (will send >>>>>> git-format patch to add to your cleanup series). So far, tested >>>>>> mtd raw/block read/writes and all works fine. Will do further tests >>>>>> as well. >>>>> >>>>> Unless I really don't understand the controller, this is non sense. >>>>> nand_read_page_op() is precisely what allows your NAND to perform a >>>>> read. Removing this call cannot work. >>>>> >>>>> What you need is a proper ->exec_op() implementation, and repeating >>>>> this becomes slightly annoying. >>>>> >>>>> Look at your qcom_op_cmd_mapping, you don't even have a path for reads. >>>>> I bet something along: >>>>> CMD_READ0: >>>>> ret = XXX_OPCODE_READ; >>>>> break; >>>>> will make it work. >>>>> >>>>> Please fix the driver and test with nandbiterrs -i. If this test works, >>>>> it is encouraging. Otherwise it is still broken. >>>> >>>> ok understand. Will fix this up. >>> >>> This is urgent now. The driver in -next is broken, shall I revert >>> everything or will you test the above fix quickly? >>> >> >> While we are able to reproduce the issue, add path for >> CMD_READ0/READ_START for IPQ platforms. All mtd tests including >> nandbiterrs works fine. But we are not able to get hold of a SDX >> device where we could reproduce the issue to debug. We are working >> offline with Manivannan for the SDX remote debug. Will keep you >> updated here and if we are not able to solve this on SDX in next >> couple of days, only way looks like revert and re-apply it for 6.7. > > If the READ path works on IPQ platforms it's already a huge step > forward, please send the fix on top of Mannivan series. > ok, will send. Please confirm if its all fine. There are more abstraction/common mode in the driver to be pulled out, but that will do later. > Now, what is the issue with SDX? Looks like SDX device that Mani is having is a 4K nand device. For some reason, after exec ops nand boot is broken on that board. We applied the fixes we did on top of Manivannan series. With that enumeration works, but still mount fails. But 4K nand device boot on IPQ works fine. Problem is we do not have a SDX board where we could debug that. We are trying to get a remote setup enabled for this. Regards, Sricharan ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [linux-next:master 1937/6910] drivers/mtd/nand/raw/qcom_nandc.c:2941 qcom_op_cmd_mapping() error: uninitialized symbol 'ret'. 2023-08-18 14:17 ` Sricharan Ramabadhran @ 2023-08-18 15:24 ` Sricharan Ramabadhran 0 siblings, 0 replies; 14+ messages in thread From: Sricharan Ramabadhran @ 2023-08-18 15:24 UTC (permalink / raw) To: Miquel Raynal Cc: Manivannan Sadhasivam, Dan Carpenter, oe-kbuild, Md Sadre Alam, lkp, oe-kbuild-all, Linux Memory Management List Hi Miquel, <..> >>>>>> >>>>>> Look at your qcom_op_cmd_mapping, you don't even have a path for >>>>>> reads. >>>>>> I bet something along: >>>>>> CMD_READ0: >>>>>> ret = XXX_OPCODE_READ; >>>>>> break; >>>>>> will make it work. >>>>>> >>>>>> Please fix the driver and test with nandbiterrs -i. If this test >>>>>> works, >>>>>> it is encouraging. Otherwise it is still broken. >>>>> >>>>> ok understand. Will fix this up. >>>> >>>> This is urgent now. The driver in -next is broken, shall I revert >>>> everything or will you test the above fix quickly? >>> >>> While we are able to reproduce the issue, add path for >>> CMD_READ0/READ_START for IPQ platforms. All mtd tests including >>> nandbiterrs works fine. But we are not able to get hold of a SDX >>> device where we could reproduce the issue to debug. We are working >>> offline with Manivannan for the SDX remote debug. Will keep you >>> updated here and if we are not able to solve this on SDX in next >>> couple of days, only way looks like revert and re-apply it for 6.7. >> >> If the READ path works on IPQ platforms it's already a huge step >> forward, please send the fix on top of Mannivan series. >> > ok, will send. Please confirm if its all fine. > There are more abstraction/common mode in the driver to be pulled > out, but that will do later. > Just now Alam posted this series for this. "[PATCH 0/3]mtd: rawnand: qcom: Fixes for exec_op". Regards, Sricharan >> Now, what is the issue with SDX? > > Looks like SDX device that Mani is having is a 4K nand device. > For some reason, after exec ops nand boot is broken on that board. > We applied the fixes we did on top of Manivannan series. > With that enumeration works, but still mount fails. But 4K nand > device boot on IPQ works fine. Problem is we do not have a SDX board > where we could debug that. We are trying to get a remote setup > enabled for this. > > Regards, > Sricharan ^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2023-08-18 15:25 UTC | newest] Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2023-08-03 12:20 [linux-next:master 1937/6910] drivers/mtd/nand/raw/qcom_nandc.c:2941 qcom_op_cmd_mapping() error: uninitialized symbol 'ret' Dan Carpenter 2023-08-04 16:45 ` Miquel Raynal 2023-08-04 16:52 ` Dan Carpenter 2023-08-04 17:07 ` Miquel Raynal 2023-08-05 6:55 ` Manivannan Sadhasivam 2023-08-06 7:58 ` Sricharan Ramabadhran 2023-08-07 18:54 ` Sricharan Ramabadhran 2023-08-07 19:14 ` Miquel Raynal 2023-08-08 5:16 ` Sricharan Ramabadhran 2023-08-18 13:33 ` Miquel Raynal 2023-08-18 13:51 ` Sricharan Ramabadhran 2023-08-18 14:03 ` Miquel Raynal 2023-08-18 14:17 ` Sricharan Ramabadhran 2023-08-18 15:24 ` Sricharan Ramabadhran
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox