linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] mtd: spi-nor: fix spi_nor_lock_and_prep() usage
@ 2020-01-07 22:23 Michael Walle
  2020-01-07 22:23 ` [PATCH 2/2] mtd: spi-nor: fix locking argument in spi_nor_is_locked() Michael Walle
  0 siblings, 1 reply; 5+ messages in thread
From: Michael Walle @ 2020-01-07 22:23 UTC (permalink / raw)
  To: linux-mtd, linux-kernel
  Cc: Vignesh Raghavendra, Tudor Ambarus, Richard Weinberger,
	Michael Walle, Miquel Raynal, Brian Norris

lock_and_prep() and unlock_and_unprep() are asymmetrical. The second
argument should be the same and represents the operation. This was
correct before commit 8cc7f33aadc8 ("mtd: spi-nor: factor out
replace-able flash_{lock,unlock}").

Fixes: 8cc7f33aadc8 ("mtd: spi-nor: factor out replace-able flash_{lock,unlock}")
Signed-off-by: Michael Walle <michael@walle.cc>
---
 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 b381bc0f825e..5cc4c0b331b3 100644
--- a/drivers/mtd/spi-nor/spi-nor.c
+++ b/drivers/mtd/spi-nor/spi-nor.c
@@ -2047,7 +2047,7 @@ static int spi_nor_lock(struct mtd_info *mtd, loff_t ofs, uint64_t len)
 
 	ret = nor->params.locking_ops->lock(nor, ofs, len);
 
-	spi_nor_unlock_and_unprep(nor, SPI_NOR_OPS_UNLOCK);
+	spi_nor_unlock_and_unprep(nor, SPI_NOR_OPS_LOCK);
 	return ret;
 }
 
@@ -2062,7 +2062,7 @@ static int spi_nor_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len)
 
 	ret = nor->params.locking_ops->unlock(nor, ofs, len);
 
-	spi_nor_unlock_and_unprep(nor, SPI_NOR_OPS_LOCK);
+	spi_nor_unlock_and_unprep(nor, SPI_NOR_OPS_UNLOCK);
 	return ret;
 }
 
-- 
2.20.1


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-01-13 11:09 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-07 22:23 [PATCH 1/2] mtd: spi-nor: fix spi_nor_lock_and_prep() usage Michael Walle
2020-01-07 22:23 ` [PATCH 2/2] mtd: spi-nor: fix locking argument in spi_nor_is_locked() Michael Walle
2020-01-13 10:10   ` Tudor.Ambarus
2020-01-13 10:19     ` Michael Walle
2020-01-13 11:09       ` Tudor.Ambarus

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).