diff mbox

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

Message ID 1450205301-32207-2-git-send-email-computersforpeace@gmail.com
State Accepted
Commit a32d5b726ff8cf32bf491522b0ac8ae2545a063e
Headers show

Commit Message

Brian Norris Dec. 15, 2015, 6:48 p.m. UTC
stm_is_locked_sr() takes the status register (SR) value as the last
parameter, not the second.

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

Comments

Brian Norris Jan. 5, 2016, 2:30 a.m. UTC | #1
On Tue, Dec 15, 2015 at 10:48:21AM -0800, Brian Norris wrote:
> stm_is_locked_sr() takes the status register (SR) value as the last
> parameter, not the second.
> 
> Reported-by: Bayi Cheng <bayi.cheng@mediatek.com>
> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
> Cc: Bayi Cheng <bayi.cheng@mediatek.com>

Bayi,

Do you care to provide your Tested-by? I might get this into 4.4 as a
fix.

Brian
diff mbox

Patch

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;
 
 	/*