summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pcilib/pci.c6
-rw-r--r--pcitool/cli.c2
2 files changed, 4 insertions, 4 deletions
diff --git a/pcilib/pci.c b/pcilib/pci.c
index 6451559..ecc4937 100644
--- a/pcilib/pci.c
+++ b/pcilib/pci.c
@@ -36,10 +36,10 @@ static int pcilib_detect_model(pcilib_t *ctx, const char *model) {
const pcilib_board_info_t *board_info = pcilib_get_board_info(ctx);
model_info = pcilib_find_plugin_model(ctx, board_info->vendor_id, board_info->device_id, model);
- if (model_info) {
- memcpy(&ctx->model_info, model_info, sizeof(pcilib_model_description_t));
- memcpy(&ctx->dma, model_info->dma, sizeof(pcilib_dma_description_t));
+ if ((model_info)&&(model_info->name)) {
ctx->model = strdup(model_info->name);
+ memcpy(&ctx->model_info, model_info, sizeof(pcilib_model_description_t));
+ if (model_info->dma) memcpy(&ctx->dma, model_info->dma, sizeof(pcilib_dma_description_t));
} else if (model) {
// If not found, check for DMA models
for (i = 0; pcilib_dma[i].name; i++) {
diff --git a/pcitool/cli.c b/pcitool/cli.c
index b267c5b..7e641da 100644
--- a/pcitool/cli.c
+++ b/pcitool/cli.c
@@ -980,7 +980,7 @@ void Info(pcilib_t *handle, const pcilib_model_description_t *model_info, const
if (info) {
printf(" %s\n", entry->d_name);
for (j = 0; info[j].name; j++) {
- pcilib_version_t version = info[j].api->version;
+ pcilib_version_t version = info[j].api?info[j].api->version:0;
printf(" %-12s %u.%u.%u - %s\n", info[j].name,
PCILIB_VERSION_GET_MAJOR(version),
PCILIB_VERSION_GET_MINOR(version),