mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-03-21 14:41:31 +00:00
net: gem: Check return value from memalign/malloc
Functions can return NULL in case of error that's why checking return value is needed. Signed-off-by: Michal Simek <michal.simek@xilinx.com> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
This commit is contained in:
parent
7674b64d78
commit
5b2c9a6ce3
1 changed files with 6 additions and 0 deletions
|
@ -633,10 +633,16 @@ static int zynq_gem_probe(struct udevice *dev)
|
|||
|
||||
/* Align rxbuffers to ARCH_DMA_MINALIGN */
|
||||
priv->rxbuffers = memalign(ARCH_DMA_MINALIGN, RX_BUF * PKTSIZE_ALIGN);
|
||||
if (!priv->rxbuffers)
|
||||
return -ENOMEM;
|
||||
|
||||
memset(priv->rxbuffers, 0, RX_BUF * PKTSIZE_ALIGN);
|
||||
|
||||
/* Align bd_space to MMU_SECTION_SHIFT */
|
||||
bd_space = memalign(1 << MMU_SECTION_SHIFT, BD_SPACE);
|
||||
if (!bd_space)
|
||||
return -ENOMEM;
|
||||
|
||||
mmu_set_region_dcache_behaviour((phys_addr_t)bd_space,
|
||||
BD_SPACE, DCACHE_OFF);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue