All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mtd: avoid registering reboot notifier twice
@ 2015-02-01  1:08 ` Niklas Cassel
  0 siblings, 0 replies; 14+ messages in thread
From: Niklas Cassel @ 2015-02-01  1:08 UTC (permalink / raw)
  To: dwmw2; +Cc: Niklas Cassel, computersforpeace, linux-mtd, linux-kernel

Calling mtd_device_parse_register with the same mtd_info
(e.g. registering several partitions on a single device)
would add the same reboot notifier twice, causing an
infinte loop in notifier_chain_register during boot up.

Signed-off-by: Niklas Cassel <nks@flawful.org>
---
 drivers/mtd/mtdcore.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c
index de79576..98efc1e 100644
--- a/drivers/mtd/mtdcore.c
+++ b/drivers/mtd/mtdcore.c
@@ -556,7 +556,7 @@ int mtd_device_parse_register(struct mtd_info *mtd, const char * const *types,
 			err = -ENODEV;
 	}
 
-	if (mtd->_reboot) {
+	if (mtd->_reboot && !mtd->reboot_notifier.notifier_call) {
 		mtd->reboot_notifier.notifier_call = mtd_reboot_notifier;
 		register_reboot_notifier(&mtd->reboot_notifier);
 	}
-- 
2.2.2

^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2015-02-08  7:00 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-01  1:08 [PATCH] mtd: avoid registering reboot notifier twice Niklas Cassel
2015-02-01  1:08 ` Niklas Cassel
2015-02-01 23:07 ` Brian Norris
2015-02-01 23:07   ` Brian Norris
2015-02-02  7:08   ` Niklas Cassel
2015-02-02  7:08     ` Niklas Cassel
2015-02-02  9:01     ` Brian Norris
2015-02-02  9:01       ` Brian Norris
2015-02-02  9:01     ` Ricard Wanderlof
2015-02-02  9:01       ` Ricard Wanderlof
2015-02-02  9:20       ` Brian Norris
2015-02-02  9:20         ` Brian Norris
2015-02-08  6:59 ` Brian Norris
2015-02-08  6:59   ` Brian Norris

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.