Check for length > 0 because otherwise len may become smaller than
0 in which case the loop never ends.

Reported-by: Alexander Shiyan <[email protected]>
Signed-off-by: Sascha Hauer <[email protected]>
---
 drivers/mtd/nand/nand_omap_gpmc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/nand_omap_gpmc.c 
b/drivers/mtd/nand/nand_omap_gpmc.c
index db1ca88791..0f3ffa1c0e 100644
--- a/drivers/mtd/nand/nand_omap_gpmc.c
+++ b/drivers/mtd/nand/nand_omap_gpmc.c
@@ -636,7 +636,7 @@ static void omap_write_buf_pref(struct nand_chip *nand_chip,
        gpmc_prefetch_enable(info->gpmc_cs,
                        PREFETCH_FIFOTHRESHOLD_MAX, 0x0, len, 0x1);
 
-       while (len) {
+       while (len > 0) {
                w_count = readl(info->gpmc_base + GPMC_PREFETCH_STATUS);
                w_count = GPMC_PREFETCH_STATUS_FIFO_CNT(w_count);
                w_count = w_count >> 2;
-- 
2.20.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

Reply via email to