]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
ARM: zynq: Fix invalid check on NAND_CMD_NONE.
authorPatrick van Gelder <patrick.vangelder@nl.bosch.com>
Fri, 24 Apr 2020 07:28:56 +0000 (01:28 -0600)
committerMichal Simek <michal.simek@xilinx.com>
Mon, 27 Apr 2020 12:21:18 +0000 (14:21 +0200)
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@nl.bosch.com>
Reviewed-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
drivers/mtd/nand/raw/zynq_nand.c

index 0aea83dac0e66a8cb86f4f77296c735704be43bc..39412974183107ea1cfbd1adc3999ac613b9a13a 100644 (file)
@@ -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;