aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorManivannan Sadhasivam <[email protected]>2023-08-05 23:11:40 +0530
committerMiquel Raynal <[email protected]>2023-08-18 16:34:26 +0200
commitb4bb4800313de0d8faa5615d4943615ff56c1cc2 (patch)
treec5e538053e1ef959ed69cb4bfef9b6c324ab7d36
parentdd3c8f4ab2035bdba41c840a7daaf1cc735f36bb (diff)
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 <[email protected]> Reported-by: Dan Carpenter <[email protected]> Closes: https://lore.kernel.org/r/[email protected]/ Fixes: 89550beb098e ("mtd: rawnand: qcom: Implement exec_op()") Signed-off-by: Manivannan Sadhasivam <[email protected]> Signed-off-by: Miquel Raynal <[email protected]> Link: https://lore.kernel.org/linux-mtd/[email protected]
-rw-r--r--drivers/mtd/nand/raw/qcom_nandc.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/mtd/nand/raw/qcom_nandc.c b/drivers/mtd/nand/raw/qcom_nandc.c
index 81084044c636..2ade27e50c43 100644
--- a/drivers/mtd/nand/raw/qcom_nandc.c
+++ b/drivers/mtd/nand/raw/qcom_nandc.c
@@ -3033,12 +3033,12 @@ static int qcom_check_op(struct nand_chip *chip,
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 ||
+ 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;