From: Sergei Shtylyov Date: Thu, 31 Oct 2019 20:37:27 +0000 (+0300) Subject: mtd: cfi_cmdset_0002: only check errors when ready in cfi_check_err_status() X-Git-Tag: v5.15~5114^2~2^2~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=72914a8cff7e1d910c58e125e15a0da409e3135f;p=platform%2Fkernel%2Flinux-starfive.git mtd: cfi_cmdset_0002: only check errors when ready in cfi_check_err_status() Cypress S26K{L|S}P{128|256|512}S datasheet says that the error bits in the status register are only valid when the "device ready" bit 7 is set. Add the check for the device ready bit in cfi_check_err_status() as that function isn't always called with this bit set. Fixes: 4844ef80305d ("mtd: cfi_cmdset_0002: Add support for polling status register") Signed-off-by: Sergei Shtylyov Signed-off-by: Vignesh Raghavendra --- diff --git a/drivers/mtd/chips/cfi_cmdset_0002.c b/drivers/mtd/chips/cfi_cmdset_0002.c index 5b2a25b..d5c2e54 100644 --- a/drivers/mtd/chips/cfi_cmdset_0002.c +++ b/drivers/mtd/chips/cfi_cmdset_0002.c @@ -136,6 +136,10 @@ static void cfi_check_err_status(struct map_info *map, struct flchip *chip, cfi->device_type, NULL); status = map_read(map, adr); + /* The error bits are invalid while the chip's busy */ + if (!map_word_bitsset(map, status, CMD(CFI_SR_DRB))) + return; + if (map_word_bitsset(map, status, CMD(0x3a))) { unsigned long chipstatus = MERGESTATUS(status);