linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Arnaud Patard (Rtp) <arnaud.patard@rtp-net.org>
To: linux-mtd@lists.infradead.org
Subject: [PATCH] Fix oops on reboot in physmap
Date: Thu, 13 Mar 2008 09:42:42 +0100	[thread overview]
Message-ID: <87fxuv816l.fsf@lechat.rtp-net.org> (raw)

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

Hi,

I sent this patch to David Woodhouse, but I forgot to put the list in
CC: (and I'm not even sure that I used the right email address :( ). So,
I'm sending the patch here so everyone can have my fix.


Thanks,
Arnaud


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: physmap_change.patch --]
[-- Type: text/x-diff, Size: 1538 bytes --]

Commit df66e7167ac756baf14d2b8ea7a2cfa056600a93 is adding support for multiple 
resources in physmap. On shutdown/supend/resume, it's suspending all resources
by calling mtd[]->suspend() without checking the mtd[] is not null.
This makes oopsing my kernel.


Signed-off-by: Arnaud Patard <arnaud.patard@rtp-net.org>
---
 arch/arm/mach-iop32x/em7210.c |   10 	6 +	4 -	0 !
 drivers/mtd/maps/physmap.c    |    8 	5 +	3 -	0 !
 2 files changed, 11 insertions(+), 7 deletions(-)

Index: linux-2.6/drivers/mtd/maps/physmap.c
===================================================================
--- linux-2.6.orig/drivers/mtd/maps/physmap.c	2008-03-02 15:37:20.000000000 +0100
+++ linux-2.6/drivers/mtd/maps/physmap.c	2008-03-02 15:43:18.000000000 +0100
@@ -204,7 +204,8 @@ static int physmap_flash_suspend(struct 
 
 	if (info)
 		for (i = 0; i < MAX_RESOURCES; i++)
-			ret |= info->mtd[i]->suspend(info->mtd[i]);
+			if (info && info->mtd[i])
+				ret |= info->mtd[i]->suspend(info->mtd[i]);
 
 	return ret;
 }
@@ -216,7 +217,8 @@ static int physmap_flash_resume(struct p
 
 	if (info)
 		for (i = 0; i < MAX_RESOURCES; i++)
-			info->mtd[i]->resume(info->mtd[i]);
+			if (info && info->mtd[i])
+				info->mtd[i]->resume(info->mtd[i]);
 	return 0;
 }
 
@@ -226,7 +228,7 @@ static void physmap_flash_shutdown(struc
 	int i;
 
 	for (i = 0; i < MAX_RESOURCES; i++)
-		if (info && info->mtd[i]->suspend(info->mtd[i]) == 0)
+		if (info && info->mtd[i] &&  info->mtd[i]->suspend(info->mtd[i]) == 0)
 			info->mtd[i]->resume(info->mtd[i]);
 }
 #else

             reply	other threads:[~2008-03-13  8:27 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-13  8:42 Arnaud Patard [this message]
2008-03-13  8:22 ` [PATCH] Fix oops on reboot in physmap Jörn Engel
2008-03-13 10:10   ` Arnaud Patard
2008-03-13  8:59     ` Jörn Engel

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=87fxuv816l.fsf@lechat.rtp-net.org \
    --to=arnaud.patard@rtp-net.org \
    --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;
as well as URLs for NNTP newsgroup(s).