- fix-the-unlock-addr-lookup-bug-in-mtd-jedec-probe.patch removed from -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled

     Fix the unlock addr lookup BUG in MTD JEDEC probe

has been removed from the -mm tree.  Its filename is

     fix-the-unlock-addr-lookup-bug-in-mtd-jedec-probe.patch

This patch was dropped because it was nacked by the maintainer

------------------------------------------------------
Subject: Fix the unlock addr lookup BUG in MTD JEDEC probe
From: Mark Zhan <rongkai.zhan@xxxxxxxxxxxxx>

This patch fixes a BUG in the function finfo_uaddr() in
driver/mtd/chips/jedec_probe.c.  This function will fetch the unlock addr
type from the pre-defined flash chip info.

static inline __u8 finfo_uaddr(const struct amd_flash_info *finfo, int device_type)
{
	int uaddr_idx;
	__u8 uaddr = MTD_UADDR_NOT_SUPPORTED;

	switch ( device_type ) {
	case CFI_DEVICETYPE_X8:  uaddr_idx = 0; break;
	case CFI_DEVICETYPE_X16: uaddr_idx = 1; break;
	case CFI_DEVICETYPE_X32: uaddr_idx = 2; break;
	default:
		printk(KERN_NOTICE "MTD: %s(): unknown device_type %d\n",
		       __func__, device_type);
		goto uaddr_done;
	}

	uaddr = finfo->uaddr[uaddr_idx];

	if (uaddr != MTD_UADDR_NOT_SUPPORTED ) {
		/* ASSERT("The unlock addresses for non-8-bit mode
		   are bollocks. We don't really need an array."); */
		uaddr = finfo->uaddr[0];
	}

  uaddr_done:
	return uaddr;
}

However, the later 'if' sentence will force that the first unlock addr type
is always returned.  If a chip has two device types (x8 x16) and the chip
works in x16 mode, this bug will result in that the chip can't be probed
correctly because the unlock addr doesn't match.

This patch fixes this bug.

Signed-off-by: Rongkai.Zhan <rongkai.zhan@xxxxxxxxxxxxx>
Cc: David Woodhouse <dwmw2@xxxxxxxxxxxxx>

dwmw2 sez:

Chip probe code makes my head hurt. I have vague memories that this was
done on purpose -- we want to drop the magic unlock addresses for
different modes and _calculate_ them instead. The difference between x8
and x16 mode is just a simple shift. I think the best answer is probably
to fix your chip's entry in the table instead.

Signed-off-by: Andrew Morton <akpm@xxxxxxxx>
---

 drivers/mtd/chips/jedec_probe.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff -puN drivers/mtd/chips/jedec_probe.c~fix-the-unlock-addr-lookup-bug-in-mtd-jedec-probe drivers/mtd/chips/jedec_probe.c
--- a/drivers/mtd/chips/jedec_probe.c~fix-the-unlock-addr-lookup-bug-in-mtd-jedec-probe
+++ a/drivers/mtd/chips/jedec_probe.c
@@ -1818,7 +1818,7 @@ static inline __u8 finfo_uaddr(const str
 
 	uaddr = finfo->uaddr[uaddr_idx];
 
-	if (uaddr != MTD_UADDR_NOT_SUPPORTED ) {
+	if (uaddr == MTD_UADDR_NOT_SUPPORTED ) {
 		/* ASSERT("The unlock addresses for non-8-bit mode
 		   are bollocks. We don't really need an array."); */
 		uaddr = finfo->uaddr[0];
_

Patches currently in -mm which might be from rongkai.zhan@xxxxxxxxxxxxx are

fix-the-unlock-addr-lookup-bug-in-mtd-jedec-probe.patch

-
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Kernel Newbies FAQ]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Photo]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux