/* Get the number of cells for a given property */
STATIC INT32 GetNumCells(IN VOID *Fdt, IN INT32 Node, IN CONST CHAR8 *Name)
/* Get the number of cells for a given property */
STATIC INT32 GetNumCells(IN VOID *Fdt, IN INT32 Node, IN CONST CHAR8 *Name)
{
  CONST INT32  *Prop;
  INT32        Len;
  UINT32       Val;
  Prop = fdt_getprop (Fdt, Node, Name, &Len);
  if (Prop == NULL) {
    return Len;
  }
  if (Len != sizeof (*Prop)) {
    return -FDT_ERR_BADNCELLS;
  }
  Val = fdt32_to_cpu (*Prop);
  if (Val > FDT_MAX_NCELLS) {
    return -FDT_ERR_BADNCELLS;
  }
  return (INT32)Val;
}