treewide: remove redundant IS_ERR() before error code check
[linux/fpc-iii.git] / arch / powerpc / boot / fsl-soc.c
blob01bad8ea62eeffdb7db3e6cb69de4d2bdc038450
1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3 * Freescale SOC support functions
5 * Author: Scott Wood <scottwood@freescale.com>
7 * Copyright (c) 2007 Freescale Semiconductor, Inc.
8 */
10 #include "ops.h"
11 #include "types.h"
12 #include "fsl-soc.h"
13 #include "stdio.h"
15 static u32 prop_buf[MAX_PROP_LEN / 4];
17 u32 *fsl_get_immr(void)
19 void *soc;
20 unsigned long ret = 0;
22 soc = find_node_by_devtype(NULL, "soc");
23 if (soc) {
24 int size;
25 u32 naddr;
27 size = getprop(soc, "#address-cells", prop_buf, MAX_PROP_LEN);
28 if (size == 4)
29 naddr = prop_buf[0];
30 else
31 naddr = 2;
33 if (naddr != 1 && naddr != 2)
34 goto err;
36 size = getprop(soc, "ranges", prop_buf, MAX_PROP_LEN);
38 if (size < 12)
39 goto err;
40 if (prop_buf[0] != 0)
41 goto err;
42 if (naddr == 2 && prop_buf[1] != 0)
43 goto err;
45 if (!dt_xlate_addr(soc, prop_buf + naddr, 8, &ret))
46 ret = 0;
49 err:
50 if (!ret)
51 printf("fsl_get_immr: Failed to find immr base\r\n");
53 return (u32 *)ret;