Skip to content

Commit 82331a7

Browse files
committed
Merge tag 'mtd/fixes-for-5.1-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux
Pull MTD fix from Richard Weinberger: "A single fix for a possible infinite loop in the cfi_cmdset_0002 driver" * tag 'mtd/fixes-for-5.1-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux: mtd: cfi: fix deadloop in cfi_cmdset_0002.c do_write_buffer
2 parents eccc58c + d9b8a67 commit 82331a7

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

drivers/mtd/chips/cfi_cmdset_0002.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1876,7 +1876,11 @@ static int __xipram do_write_buffer(struct map_info *map, struct flchip *chip,
18761876
continue;
18771877
}
18781878

1879-
if (time_after(jiffies, timeo) && !chip_ready(map, adr))
1879+
/*
1880+
* We check "time_after" and "!chip_good" before checking "chip_good" to avoid
1881+
* the failure due to scheduling.
1882+
*/
1883+
if (time_after(jiffies, timeo) && !chip_good(map, adr, datum))
18801884
break;
18811885

18821886
if (chip_good(map, adr, datum)) {

0 commit comments

Comments
 (0)