of/flattree: merge early_init_dt_scan_memory() common code