public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: "David Byron" <dbyron@hheld.com>
To: <linux-mtd@lists.infradead.org>
Subject: initializing chip->wq in cfi_cmdset_0002.c
Date: Sat, 1 Jul 2006 11:18:02 -0700	[thread overview]
Message-ID: <001101c69d3a$b12f2a00$6534800a@RudiDell> (raw)

I'm using cfi_cmdset_0002.c to access a flash chip and I ran into an oops
from trying to dereference a null pointer.  I found a fix for it, but I feel
like there must be something I don't understand.  Seems like other folks
would have run into this as well.

The crash comes with the call to wake_up(&chip->wq) on the last line of
put_chip.  I can't see anywhere that this data structure is initialized.  I
looked at some of the other cfi_cmdset* files and decided that

diff --git a/drivers/mtd/chips/cfi_cmdset_0002.c
b/drivers/mtd/chips/cfi_cmdset_0002.c
index 9885726..8a390b3 100644
--- a/drivers/mtd/chips/cfi_cmdset_0002.c
+++ b/drivers/mtd/chips/cfi_cmdset_0002.c
@@ -320,6 +320,7 @@ #endif
 		cfi->chips[i].word_write_time =
1<<cfi->cfiq->WordWriteTimeoutTyp;
 		cfi->chips[i].buffer_write_time =
1<<cfi->cfiq->BufWriteTimeoutTyp;
 		cfi->chips[i].erase_time =
1<<cfi->cfiq->BlockEraseTimeoutTyp;
+		init_waitqueue_head(&cfi->chips[i].wq);
 	}
 
 	map->fldrv = &cfi_amdstd_chipdrv;

was a good place to initialize.  It fixes the oops for me.  Can someone
confirm that this makes sense?

Thanks much.

-DB

             reply	other threads:[~2006-07-01 18:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-01 18:18 David Byron [this message]
2006-07-01 22:46 ` initializing chip->wq in cfi_cmdset_0002.c Thomas Gleixner

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='001101c69d3a$b12f2a00$6534800a@RudiDell' \
    --to=dbyron@hheld.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox