Files
rtems/cpukit/libpci/pci_dev_create.c
Sebastian Huber 76b9c313ac libpci: Use calloc()
Update #2133.
2017-08-25 11:01:15 +02:00

34 lines
665 B
C

/* Device allocator helper used by PCI Auto/Read Configuration Library
*
* COPYRIGHT (c) 2010 Cobham Gaisler AB.
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.org/license/LICENSE.
*/
#include <rtems.h>
#include <stdlib.h>
#include <rtems/bspIo.h>
#include <pci.h>
#include <pci/cfg.h>
#include "pci_internal.h"
struct pci_dev *pci_dev_create(int isbus)
{
void *ptr;
int size;
if (isbus)
size = sizeof(struct pci_bus);
else
size = sizeof(struct pci_dev);
ptr = calloc(1, size);
if (!ptr)
rtems_fatal_error_occurred(RTEMS_NO_MEMORY);
return ptr;
}