Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Coverify fixes in QDMA driver #193

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion QDMA/linux-kernel/driver/libqdma/libqdma_export.c
Original file line number Diff line number Diff line change
Expand Up @@ -1115,8 +1115,10 @@ int qdma_queue_config(unsigned long dev_hndl, unsigned long qid,
if (rv != 0)
return rv;

lock_descq(descq);
/** configure descriptor queue */
qdma_descq_config(descq, qconf, 1);
unlock_descq(descq);

snprintf(buf, buflen,
"Queue %s id %u is configured with the qconf passed ",
Expand Down Expand Up @@ -1588,7 +1590,9 @@ int qdma_queue_add(unsigned long dev_hndl, struct qdma_queue_conf *qconf,
if (rv > 0) {
/** support only 1 queue in legacy interrupt mode */
intr_legacy_clear(descq);
lock_descq(descq);
descq->q_state = Q_STATE_DISABLED;
unlock_descq(descq);
pr_debug("qdma%05x - Q%u - No free queues %u/%u.\n",
xdev->conf.bdf, descq->conf.qidx,
rv, 1);
Expand All @@ -1599,7 +1603,9 @@ int qdma_queue_add(unsigned long dev_hndl, struct qdma_queue_conf *qconf,
return rv;
} else if (rv < 0) {
rv = -EINVAL;
lock_descq(descq);
descq->q_state = Q_STATE_DISABLED;
unlock_descq(descq);
pr_debug("qdma%05x Legacy interrupt setup failed.\n",
xdev->conf.bdf);
snprintf(buf, buflen,
Expand Down Expand Up @@ -1786,16 +1792,17 @@ int qdma_queue_start(unsigned long dev_hndl, unsigned long id,
unlock_descq(descq);
return -ERANGE;
}
unlock_descq(descq);
/** complete the queue configuration*/
rv = qdma_descq_config_complete(descq);
if (rv < 0) {
pr_err("%s 0x%x setup failed.\n",
descq->conf.name, descq->qidx_hw);
snprintf(buf, buflen,
"%s config failed.\n", descq->conf.name);
unlock_descq(descq);
return -EIO;
}
unlock_descq(descq);

/** allocate the queue resources*/
rv = qdma_descq_alloc_resource(descq);
Expand Down
2 changes: 1 addition & 1 deletion QDMA/linux-kernel/driver/libqdma/libqdma_export.h
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ struct qdma_dev_conf {
/** pointer to pci_dev */
struct pci_dev *pdev;
/** Maximum number of queue pairs per device */
unsigned short qsets_max;
u32 qsets_max;
/** Reserved */
unsigned short rsvd2;
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2544,7 +2544,7 @@ static int dump_eqdma_context(struct qdma_descq_context *queue_context,
int n;
int len = 0;
int rv;
char banner[DEBGFS_LINE_SZ];
char banner[DEBGFS_LINE_SZ] = "";

if (queue_context == NULL) {
qdma_log_error("%s: queue_context is NULL, err:%d\n",
Expand Down
2 changes: 0 additions & 2 deletions QDMA/linux-kernel/driver/libqdma/qdma_intr.c
Original file line number Diff line number Diff line change
Expand Up @@ -284,8 +284,6 @@ static void data_intr_direct(struct xlnx_dma_dev *xdev, int vidx, int irq,
flags);
list_for_each_safe(entry, tmp, descq_list) {
descq = container_of(entry, struct qdma_descq, intr_list);
if (!descq)
continue;

if (descq->conf.ping_pong_en &&
descq->conf.q_type == Q_C2H && descq->conf.st)
Expand Down
8 changes: 7 additions & 1 deletion QDMA/linux-kernel/driver/libqdma/qdma_regs.c
Original file line number Diff line number Diff line change
Expand Up @@ -582,11 +582,16 @@ int qdma_queue_cmpl_ctrl(unsigned long dev_hndl, unsigned long id,
unlock_descq(descq);

} else {
lock_descq(descq);
/* read the setting */
rv = queue_cmpt_cidx_read(descq->xdev,
descq->conf.qidx, &descq->cmpt_cidx_info);
if (unlikely(rv < 0))
if (unlikely(rv < 0)) {
pr_err("%s: Failed to read cmpt cidx\n",
descq->conf.name);
unlock_descq(descq);
return rv;
}

cctrl->trigger_mode = descq->conf.cmpl_trig_mode =
descq->cmpt_cidx_info.trig_mode;
Expand All @@ -598,6 +603,7 @@ int qdma_queue_cmpl_ctrl(unsigned long dev_hndl, unsigned long id,
descq->cmpt_cidx_info.wrb_en;
cctrl->cmpl_en_intr = descq->conf.cmpl_en_intr =
descq->cmpt_cidx_info.irq_en;
unlock_descq(descq);
}

return 0;
Expand Down
2 changes: 1 addition & 1 deletion QDMA/linux-kernel/driver/libqdma/xdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -1117,7 +1117,7 @@ int qdma_device_open(const char *mod_name, struct qdma_dev_conf *conf,

rv = qdma_dev_qinfo_get(xdev->dma_device_index, xdev->func_id,
&xdev->conf.qsets_base,
(uint32_t *) &xdev->conf.qsets_max);
&xdev->conf.qsets_max);
if (rv < 0) {
rv = qdma_dev_entry_create(xdev->dma_device_index,
xdev->func_id);
Expand Down