On 5/23/23 20:48, Hernan Vargas wrote:
Adding exception to prevent segmentation fault in case a queue is
started which was not configured earlier.
Fixes: c58109a8871d ("baseband/fpga_5gnr_fec: add queue configuration")
Cc: [email protected]
Signed-off-by: Hernan Vargas <[email protected]>
---
drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c
b/drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c
index 9388cce52960..a6211f73e6e3 100644
--- a/drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c
+++ b/drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c
@@ -573,6 +573,10 @@ fpga_queue_start(struct rte_bbdev *dev, uint16_t queue_id)
return -1;
}
#endif
+ if (dev->data->queues[queue_id].queue_private == NULL) {
+ rte_bbdev_log(ERR, "Cannot start invalid queue %d", queue_id);
+ return -1;
+ }
struct fpga_queue *q = dev->data->queues[queue_id].queue_private;
uint32_t offset = FPGA_5GNR_FEC_RING_CTRL_REGS +
(sizeof(struct fpga_ring_ctrl_reg) * q->q_idx);
Same comment here for offset and q declarations, it should be at the top
of the function.
Maxime