summaryrefslogtreecommitdiffstats
path: root/pcilib/pci.c
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@suren.me>2023-05-25 21:54:27 +0200
committerSuren A. Chilingaryan <csa@suren.me>2023-05-25 21:56:14 +0200
commit8a71f80b564195735b034f16599f3abdf8690f2e (patch)
tree5679b30941ef5487b46feb340e7a27f364f42aae /pcilib/pci.c
parentbd3d3af50f7e538ab6ee1974039896487dbcbea3 (diff)
downloadpcitool-8a71f80b564195735b034f16599f3abdf8690f2e.tar.gz
pcitool-8a71f80b564195735b034f16599f3abdf8690f2e.tar.bz2
pcitool-8a71f80b564195735b034f16599f3abdf8690f2e.tar.xz
pcitool-8a71f80b564195735b034f16599f3abdf8690f2e.zip
Tolerate some missing bits in the plugin description
Diffstat (limited to 'pcilib/pci.c')
-rw-r--r--pcilib/pci.c6
1 files changed, 3 insertions, 3 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++) {