public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* Fix bug with the assumtion that cmdset_priv is always valid
@ 2002-09-30 21:50 Boris Itkis
  0 siblings, 0 replies; only message in thread
From: Boris Itkis @ 2002-09-30 21:50 UTC (permalink / raw)
  To: linux-mtd

[-- Attachment #1: Type: text/plain, Size: 256 bytes --]

Jedec probe produces P_ID_INTEL_STD (semi cfi flash configuration) 
without cmdset_priv. So I
fixed cfi_cmdset_0001.c to live with this by testing for cmdset_priv and 
working around the
missing data.

Files affected:

drivers/mtd/chips/cfi_cmdset_0001.c


[-- Attachment #2: diff_f10_2 --]
[-- Type: text/plain, Size: 972 bytes --]

diff -urN linux-2.4.19/drivers/mtd/chips/cfi_cmdset_0001.c linux.orig/drivers/mtd/chips/cfi_cmdset_0001.c
--- linux-2.4.19/drivers/mtd/chips/cfi_cmdset_0001.c	Mon Sep 30 09:50:46 2002
+++ linux.orig/drivers/mtd/chips/cfi_cmdset_0001.c	Mon Sep 30 10:04:06 2002
@@ -300,6 +300,8 @@
 	 */
 	switch (chip->state) {
 	case FL_ERASING:
+		if (!((struct cfi_pri_intelext *)cfi->cmdset_priv))
+			goto sleep; /* Must be in Jedec Mode so assume sleep */
 		if (!(((struct cfi_pri_intelext *)cfi->cmdset_priv)->FeatureSupport & 2))
 			goto sleep; /* We don't support erase suspend */
 		
@@ -543,6 +545,14 @@
 	struct cfi_private *cfi = map->fldrv_priv;
 	struct cfi_pri_intelext *extp=cfi->cmdset_priv;
 	int base_offst,reg_sz;
+
+	if(!extp)
+	{
+		printk(KERN_WARNING
+			"%s: This flash devive is a Jedec Flash so no protection data to read!\n"
+			,map->name);
+		return 0;
+	}
 	
 	/* Check that we actually have some protection registers */
 	if(!(extp->FeatureSupport&64)){

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2002-09-30 21:52 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-09-30 21:50 Fix bug with the assumtion that cmdset_priv is always valid Boris Itkis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox