All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Jörn Engel" <joern@logfs.org>
To: Arnaud Patard <arnaud.patard@rtp-net.org>
Cc: David Woodhouse <dwmw2@infradead.org>, linux-mtd@lists.infradead.org
Subject: Re: [PATCH] Fix oops on reboot in physmap
Date: Thu, 13 Mar 2008 09:22:24 +0100	[thread overview]
Message-ID: <20080313082224.GA2187@logfs.org> (raw)
In-Reply-To: <87fxuv816l.fsf@lechat.rtp-net.org>

On Thu, 13 March 2008 09:42:42 +0100, Arnaud Patard wrote:
> 
> 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.

There were various small errors in it, afaics.  Does this patch achieve
the same result for you?

Added dwmw2 on Cc:.  This could be material for -stable.

Jörn

-- 
Prosperity makes friends, adversity tries them.
-- Publilius Syrus

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>
Signed-Off-By: Joern Engel <joern@logfs.org>

diff --git a/drivers/mtd/maps/physmap.c b/drivers/mtd/maps/physmap.c
index f00e04e..1abecd5 100644
--- a/drivers/mtd/maps/physmap.c
+++ b/drivers/mtd/maps/physmap.c
@@ -204,7 +204,8 @@ static int physmap_flash_suspend(struct platform_device *dev, pm_message_t state
 
 	if (info)
 		for (i = 0; i < MAX_RESOURCES; i++)
-			ret |= info->mtd[i]->suspend(info->mtd[i]);
+			if (info->mtd[i])
+				ret |= info->mtd[i]->suspend(info->mtd[i]);
 
 	return ret;
 }
@@ -216,7 +217,8 @@ static int physmap_flash_resume(struct platform_device *dev)
 
 	if (info)
 		for (i = 0; i < MAX_RESOURCES; i++)
-			info->mtd[i]->resume(info->mtd[i]);
+			if (info->mtd[i])
+				info->mtd[i]->resume(info->mtd[i]);
 	return 0;
 }
 
@@ -225,9 +227,10 @@ static void physmap_flash_shutdown(struct platform_device *dev)
 	struct physmap_flash_info *info = platform_get_drvdata(dev);
 	int i;
 
-	for (i = 0; i < MAX_RESOURCES; i++)
-		if (info && info->mtd[i]->suspend(info->mtd[i]) == 0)
-			info->mtd[i]->resume(info->mtd[i]);
+	if (info)
+		for (i = 0; i < MAX_RESOURCES; i++)
+			if (info->mtd[i] && info->mtd[i]->suspend(info->mtd[i]) == 0)
+				info->mtd[i]->resume(info->mtd[i]);
 }
 #else
 #define physmap_flash_suspend NULL

  reply	other threads:[~2008-03-13  9:21 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-13  8:42 [PATCH] Fix oops on reboot in physmap Arnaud Patard
2008-03-13  8:22 ` Jörn Engel [this message]
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=20080313082224.GA2187@logfs.org \
    --to=joern@logfs.org \
    --cc=arnaud.patard@rtp-net.org \
    --cc=dwmw2@infradead.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 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.