Skip to content

Commit b4bb480

Browse files
Mani-Sadhasivammiquelraynal
authored andcommitted
mtd: rawnand: qcom: Fix the opcode check in qcom_check_op()
qcom_check_op() function checks for the invalid opcode for the instruction types. Currently, it just returns -ENOTSUPP for all opcodes of NAND_OP_CMD_INSTR type due to the use of "||" operator instead of "&&". Fix it! This also fixes the following smatch warning: drivers/mtd/nand/raw/qcom_nandc.c:3036 qcom_check_op() warn: was && intended here instead of ||? 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/ Fixes: 89550be ("mtd: rawnand: qcom: Implement exec_op()") Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/20230805174146.57006-5-manivannan.sadhasivam@linaro.org
1 parent dd3c8f4 commit b4bb480

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

drivers/mtd/nand/raw/qcom_nandc.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3033,12 +3033,12 @@ static int qcom_check_op(struct nand_chip *chip,
30333033

30343034
switch (instr->type) {
30353035
case NAND_OP_CMD_INSTR:
3036-
if (instr->ctx.cmd.opcode != NAND_CMD_RESET ||
3037-
instr->ctx.cmd.opcode != NAND_CMD_READID ||
3038-
instr->ctx.cmd.opcode != NAND_CMD_PARAM ||
3039-
instr->ctx.cmd.opcode != NAND_CMD_ERASE1 ||
3040-
instr->ctx.cmd.opcode != NAND_CMD_ERASE2 ||
3041-
instr->ctx.cmd.opcode != NAND_CMD_STATUS ||
3036+
if (instr->ctx.cmd.opcode != NAND_CMD_RESET &&
3037+
instr->ctx.cmd.opcode != NAND_CMD_READID &&
3038+
instr->ctx.cmd.opcode != NAND_CMD_PARAM &&
3039+
instr->ctx.cmd.opcode != NAND_CMD_ERASE1 &&
3040+
instr->ctx.cmd.opcode != NAND_CMD_ERASE2 &&
3041+
instr->ctx.cmd.opcode != NAND_CMD_STATUS &&
30423042
instr->ctx.cmd.opcode != NAND_CMD_PAGEPROG)
30433043
return -ENOTSUPP;
30443044
break;

0 commit comments

Comments
 (0)