Message ID | e21e6edcec9bb814656af89f2440a6f3bd043b02.1587723932.git.michal.simek@xilinx.com |
---|---|
State | Accepted |
Commit | 27d706937a5c72f0414a540ca20fd36b4b72bda7 |
Headers | show |
Series | ARM: zynq: Fix invalid check on NAND_CMD_NONE. | expand |
p? 24. 4. 2020 v 12:25 odes?latel Michal Simek <michal.simek at xilinx.com> napsal: > > From: Patrick van Gelder <patrick.vangelder at nl.bosch.com> > > The end_cmd field in the variables cmd_phase_addr and data_phase_addr > contains the value 0xFF when the end_cmd equals NAND_CMD_NONE. This > should be 0x00. > > This is caused by comparing NAND_CMD_NONE (int) with end_cmd (u8). > end_cmd will be promoted by the int value -1 and therefore is not equal > to 0xFF. Solved by casting NAND_CMD_NONE to u8 which will avoid int > promotion. > > Signed-off-by: Patrick van Gelder <patrick.vangelder at nl.bosch.com> > Reviewed-by: T Karthik Reddy <t.karthik.reddy at xilinx.com> > Signed-off-by: Michal Simek <michal.simek at xilinx.com> > --- > > drivers/mtd/nand/raw/zynq_nand.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/mtd/nand/raw/zynq_nand.c b/drivers/mtd/nand/raw/zynq_nand.c > index 0aea83dac0e6..394129741831 100644 > --- a/drivers/mtd/nand/raw/zynq_nand.c > +++ b/drivers/mtd/nand/raw/zynq_nand.c > @@ -845,7 +845,7 @@ static void zynq_nand_cmd_function(struct mtd_info *mtd, unsigned int command, > if (curr_cmd->end_cmd_valid == ZYNQ_NAND_CMD_PHASE) > end_cmd_valid = 1; > > - if (curr_cmd->end_cmd == NAND_CMD_NONE) > + if (curr_cmd->end_cmd == (u8)NAND_CMD_NONE) > end_cmd = 0x0; > else > end_cmd = curr_cmd->end_cmd; > -- > 2.26.2 > Applied. M
diff --git a/drivers/mtd/nand/raw/zynq_nand.c b/drivers/mtd/nand/raw/zynq_nand.c index 0aea83dac0e6..394129741831 100644 --- a/drivers/mtd/nand/raw/zynq_nand.c +++ b/drivers/mtd/nand/raw/zynq_nand.c @@ -845,7 +845,7 @@ static void zynq_nand_cmd_function(struct mtd_info *mtd, unsigned int command, if (curr_cmd->end_cmd_valid == ZYNQ_NAND_CMD_PHASE) end_cmd_valid = 1; - if (curr_cmd->end_cmd == NAND_CMD_NONE) + if (curr_cmd->end_cmd == (u8)NAND_CMD_NONE) end_cmd = 0x0; else end_cmd = curr_cmd->end_cmd;