All of lore.kernel.org
 help / color / mirror / Atom feed
From: Boris Itkis <boris@fortunet.com>
To: linux-mtd@lists.infradead.org
Subject: Fix bug with the assumtion that cmdset_priv is always valid
Date: Mon, 30 Sep 2002 14:50:13 -0700	[thread overview]
Message-ID: <3D98C715.7080801@fortunet.com> (raw)

[-- 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)){

                 reply	other threads:[~2002-09-30 21:52 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3D98C715.7080801@fortunet.com \
    --to=boris@fortunet.com \
    --cc=linux-mtd@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.