diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/common_iterator.c | 3 | ||||
-rw-r--r-- | src/linux_sysfs.c | 7 |
2 files changed, 6 insertions, 4 deletions
diff --git a/src/common_iterator.c b/src/common_iterator.c index 73d2755..83cade3 100644 --- a/src/common_iterator.c +++ b/src/common_iterator.c @@ -158,6 +158,9 @@ pci_device_next( struct pci_device_iterator * iter ) { struct pci_device_private * d = NULL; + if (!iter) + return NULL; + switch( iter->mode ) { case match_any: if ( iter->next_index < pci_sys->num_devices ) { diff --git a/src/linux_sysfs.c b/src/linux_sysfs.c index 5fa0ea1..9e53fac 100644 --- a/src/linux_sysfs.c +++ b/src/linux_sysfs.c @@ -114,6 +114,9 @@ pci_system_linux_sysfs_create( void ) pci_sys = calloc( 1, sizeof( struct pci_system ) ); if ( pci_sys != NULL ) { pci_sys->methods = & linux_sysfs_methods; +#ifdef HAVE_MTRR + pci_sys->mtrr_fd = open("/proc/mtrr", O_WRONLY); +#endif err = populate_entries(pci_sys); } else { @@ -124,10 +127,6 @@ pci_system_linux_sysfs_create( void ) err = errno; } -#ifdef HAVE_MTRR - pci_sys->mtrr_fd = open("/proc/mtrr", O_WRONLY); -#endif - return err; } |