Skip to content

Commit 9bb11ca

Browse files
gonzouamergify[bot]
authored andcommitted
EmbeddedPkg: Remove misleading error message in FindNextMemoryNodeReg
FindNextMemoryNodeReg prints "ignoring disabled memory node" for all top-level disabled nodes in the tree, not just the ones with the "device_type" property set to "memory". Rework the loop to only print the message for the relevant nodes. Signed-off-by: Oleksandr Tymoshenko <[email protected]>
1 parent 107981f commit 9bb11ca

File tree

1 file changed

+32
-30
lines changed

1 file changed

+32
-30
lines changed

EmbeddedPkg/Drivers/FdtClientDxe/FdtClientDxe.c

Lines changed: 32 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -262,43 +262,45 @@ FindNextMemoryNodeReg (
262262
break;
263263
}
264264

265+
DeviceType = fdt_getprop (mDeviceTreeBase, Next, "device_type", &Len);
266+
if ((DeviceType == NULL) || (AsciiStrCmp (DeviceType, "memory") != 0)) {
267+
continue;
268+
}
269+
265270
if (!IsNodeEnabled (Next)) {
266271
DEBUG ((DEBUG_WARN, "%a: ignoring disabled memory node\n", __func__));
267272
continue;
268273
}
269274

270-
DeviceType = fdt_getprop (mDeviceTreeBase, Next, "device_type", &Len);
271-
if ((DeviceType != NULL) && (AsciiStrCmp (DeviceType, "memory") == 0)) {
272-
//
273-
// Get the 'reg' property of this memory node. For now, we will assume
274-
// 8 byte quantities for base and size, respectively.
275-
// TODO use #cells root properties instead
276-
//
277-
Status = GetNodeProperty (This, Next, "reg", Reg, RegSize);
278-
if (EFI_ERROR (Status)) {
279-
DEBUG ((
280-
DEBUG_WARN,
281-
"%a: ignoring memory node with no 'reg' property\n",
282-
__func__
283-
));
284-
continue;
285-
}
286-
287-
if ((*RegSize % 16) != 0) {
288-
DEBUG ((
289-
DEBUG_WARN,
290-
"%a: ignoring memory node with invalid 'reg' property (size == 0x%x)\n",
291-
__func__,
292-
*RegSize
293-
));
294-
continue;
295-
}
275+
//
276+
// Get the 'reg' property of this memory node. For now, we will assume
277+
// 8 byte quantities for base and size, respectively.
278+
// TODO use #cells root properties instead
279+
//
280+
Status = GetNodeProperty (This, Next, "reg", Reg, RegSize);
281+
if (EFI_ERROR (Status)) {
282+
DEBUG ((
283+
DEBUG_WARN,
284+
"%a: ignoring memory node with no 'reg' property\n",
285+
__func__
286+
));
287+
continue;
288+
}
296289

297-
*Node = Next;
298-
*AddressCells = 2;
299-
*SizeCells = 2;
300-
return EFI_SUCCESS;
290+
if ((*RegSize % 16) != 0) {
291+
DEBUG ((
292+
DEBUG_WARN,
293+
"%a: ignoring memory node with invalid 'reg' property (size == 0x%x)\n",
294+
__func__,
295+
*RegSize
296+
));
297+
continue;
301298
}
299+
300+
*Node = Next;
301+
*AddressCells = 2;
302+
*SizeCells = 2;
303+
return EFI_SUCCESS;
302304
}
303305

304306
return EFI_NOT_FOUND;

0 commit comments

Comments
 (0)