diff options
author | Kumar Gala <galak@freescale.com> | 2005-06-25 17:54:36 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-06-25 19:24:26 -0400 |
commit | 62aa751d16399637325852bc0a1fcf13c2476dd7 (patch) | |
tree | 5d2bcc52ea85e05e5d487be73500847614bc8bcd /arch/ppc/platforms/83xx/mpc834x_sys.c | |
parent | 09ffd94fb15d85fbf9eebb8180f50264b264d6fe (diff) |
[PATCH] ppc32: Check return of ppc_sys_get_pdata before accessing pointer
Ensure that the returned pointer from ppc_sys_get_pdata is not NULL before we
start using it. This handles any cases where we have variants of processors
on the same board with different functionality.
Signed-off-by: Kumar Gala <kumar.gala@freescale.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch/ppc/platforms/83xx/mpc834x_sys.c')
-rw-r--r-- | arch/ppc/platforms/83xx/mpc834x_sys.c | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/arch/ppc/platforms/83xx/mpc834x_sys.c b/arch/ppc/platforms/83xx/mpc834x_sys.c index 37ece154279..ddd04d4c1ea 100644 --- a/arch/ppc/platforms/83xx/mpc834x_sys.c +++ b/arch/ppc/platforms/83xx/mpc834x_sys.c | |||
@@ -94,20 +94,24 @@ mpc834x_sys_setup_arch(void) | |||
94 | 94 | ||
95 | /* setup the board related information for the enet controllers */ | 95 | /* setup the board related information for the enet controllers */ |
96 | pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC83xx_TSEC1); | 96 | pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC83xx_TSEC1); |
97 | pdata->board_flags = FSL_GIANFAR_BRD_HAS_PHY_INTR; | 97 | if (pdata) { |
98 | pdata->interruptPHY = MPC83xx_IRQ_EXT1; | 98 | pdata->board_flags = FSL_GIANFAR_BRD_HAS_PHY_INTR; |
99 | pdata->phyid = 0; | 99 | pdata->interruptPHY = MPC83xx_IRQ_EXT1; |
100 | /* fixup phy address */ | 100 | pdata->phyid = 0; |
101 | pdata->phy_reg_addr += binfo->bi_immr_base; | 101 | /* fixup phy address */ |
102 | memcpy(pdata->mac_addr, binfo->bi_enetaddr, 6); | 102 | pdata->phy_reg_addr += binfo->bi_immr_base; |
103 | memcpy(pdata->mac_addr, binfo->bi_enetaddr, 6); | ||
104 | } | ||
103 | 105 | ||
104 | pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC83xx_TSEC2); | 106 | pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC83xx_TSEC2); |
105 | pdata->board_flags = FSL_GIANFAR_BRD_HAS_PHY_INTR; | 107 | if (pdata) { |
106 | pdata->interruptPHY = MPC83xx_IRQ_EXT2; | 108 | pdata->board_flags = FSL_GIANFAR_BRD_HAS_PHY_INTR; |
107 | pdata->phyid = 1; | 109 | pdata->interruptPHY = MPC83xx_IRQ_EXT2; |
108 | /* fixup phy address */ | 110 | pdata->phyid = 1; |
109 | pdata->phy_reg_addr += binfo->bi_immr_base; | 111 | /* fixup phy address */ |
110 | memcpy(pdata->mac_addr, binfo->bi_enet1addr, 6); | 112 | pdata->phy_reg_addr += binfo->bi_immr_base; |
113 | memcpy(pdata->mac_addr, binfo->bi_enet1addr, 6); | ||
114 | } | ||
111 | 115 | ||
112 | #ifdef CONFIG_BLK_DEV_INITRD | 116 | #ifdef CONFIG_BLK_DEV_INITRD |
113 | if (initrd_start) | 117 | if (initrd_start) |