[PATCH for-4.4 2/2] mtd: spi-nor: fix stm_is_locked_sr() parameters

Brian Norris computersforpeace at gmail.com
Tue Dec 15 10:48:21 PST 2015


stm_is_locked_sr() takes the status register (SR) value as the last
parameter, not the second.

Reported-by: Bayi Cheng <bayi.cheng at mediatek.com>
Signed-off-by: Brian Norris <computersforpeace at gmail.com>
Cc: Bayi Cheng <bayi.cheng at mediatek.com>
---
 drivers/mtd/spi-nor/spi-nor.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c
index f5d59de1ee6e..32477c4eb421 100644
--- a/drivers/mtd/spi-nor/spi-nor.c
+++ b/drivers/mtd/spi-nor/spi-nor.c
@@ -516,8 +516,8 @@ static int stm_unlock(struct spi_nor *nor, loff_t ofs, uint64_t len)
 	status_old = read_sr(nor);
 
 	/* Cannot unlock; would unlock larger region than requested */
-	if (stm_is_locked_sr(nor, status_old, ofs - mtd->erasesize,
-			     mtd->erasesize))
+	if (stm_is_locked_sr(nor, ofs - mtd->erasesize, mtd->erasesize,
+			     status_old))
 		return -EINVAL;
 
 	/*
-- 
2.6.0.rc2.230.g3dd15c0




More information about the linux-mtd mailing list