/* Read a property of size <prop_len>. Currently only supports 1 or 2 cells.  */
static int fdt_read_prop(const fdt32_t *prop, int prop_len, int cell_off, uint64_t *val, int cells)
/* Read a property of size <prop_len>. Currently only supports 1 or 2 cells.  */
static int fdt_read_prop(const fdt32_t *prop, int prop_len, int cell_off, uint64_t *val, int cells)
{
	const fdt32_t *prop32 = &prop[cell_off];
	const unaligned_fdt64_t *prop64 = (const fdt64_t *)&prop[cell_off];
	if ((cell_off + cells) > prop_len)
		return -FDT_ERR_NOSPACE;
	switch (cells) {
	case 1:
		*val = fdt32_to_cpu(*prop32);
		break;
	case 2:
		*val = fdt64_to_cpu(*prop64);
		break;
	default:
		return -FDT_ERR_NOSPACE;
	}
	return 0;
}