mtd: spi-nor.c: wrong test in stm_unlock()

Giorgio giorgio.nicole at arcor.de
Sun May 8 13:05:48 PDT 2016


Hi,

I noticed a wrong test within the function stm_unlock() in spi-nor.c in
the kernel 4.6-rc5:

static int stm_unlock(struct spi_nor *nor, loff_t ofs, uint64_t len)
{
	struct mtd_info *mtd = &nor->mtd;
	int status_old, status_new;
	u8 mask = SR_BP2 | SR_BP1 | SR_BP0;
...
...
	/* Don't protect status register if we're fully unlocked */
	if (lock_len == mtd->size)
		status_new &= ~SR_SRWD;
...

This last if test should be:

	if (lock_len == 0)
		status_new &= ~SR_SRWD;

giorgio

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 246 bytes
Desc: OpenPGP digital signature
URL: <http://lists.infradead.org/pipermail/linux-mtd/attachments/20160508/3a7b2ce0/attachment.sig>


More information about the linux-mtd mailing list