lkml.org 
[lkml]   [2015]   [Feb]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] mtd: avoid registering reboot notifier twice

On 02/02/2015 12:07 AM, Brian Norris wrote:
> On Sun, Feb 01, 2015 at 02:08:50AM +0100, Niklas Cassel wrote:
>> 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.
> No driver should be calling mtd_device_parse_register() multiple times
> on the same mtd_info. Under what context do you see this? What driver?
arch/cris/arch-v32/drivers/axisflashmap.c

It calls mtd_device_register for different partitions on same device using the same mtd_info.

What do you suggest this driver should do instead?

>
>> 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);
>> }
> Brian



\
 
 \ /
  Last update: 2015-02-02 08:41    [W:1.608 / U:0.328 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site