On 02/28/18 05:27, Chintan Pandya wrote: > > > On 2/15/2018 6:22 AM, frowand.list@xxxxxxxxx wrote: > >> +static void of_populate_phandle_cache(void) >> +{ >> + unsigned long flags; >> + u32 cache_entries; >> + struct device_node *np; >> + u32 phandles = 0; >> + >> + raw_spin_lock_irqsave(&devtree_lock, flags); >> + >> + kfree(phandle_cache); >> + phandle_cache = NULL; >> + >> + for_each_of_allnodes(np) >> + if (np->phandle && np->phandle != OF_PHANDLE_ILLEGAL) >> + phandles++; >> + >> + cache_entries = roundup_pow_of_two(phandles); >> + phandle_cache_mask = cache_entries - 1; >> + >> + phandle_cache = kcalloc(cache_entries, sizeof(*phandle_cache), >> + GFP_ATOMIC); >> + > > NULL check of phandle_cache would be good to have. Thanks for catching that. >> + for_each_of_allnodes(np) >> + if (np->phandle && np->phandle != OF_PHANDLE_ILLEGAL) >> + phandle_cache[np->phandle & phandle_cache_mask] = np; >> + >> + raw_spin_unlock_irqrestore(&devtree_lock, flags); >> +} > > > Chintan -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html