net/dpaa2: fix possible use of uninitialized vars
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): VI1PR0401MB25419AE95E8E6BCE90FE8F0C89BB0@VI1PR0401MB2541.eurprd04.prod.outlook.com
Quoted 26 lines · Hemant Agrawal
Hi Andrzei,
Quoted 10 lines
-----Original Message-----
drivers/net/dpaa2/mc/dpni.c +0
-0@@ -1803,10 +1803,13 @@ int dpni_set_congestion_notification(struct fsl_mc_io *mc_io, cmd_params->qtype = qtype; cmd_params->tc = tc_id;drivers/net/dpaa2/mc/dpni.c int dpni_set_congestion_notification(struct · line 1813
Quoted 10 lines
drivers/net/dpaa2/mc/dpni.c +6
-2cmd_params->congestion_point = cfg->cg_point; - cmd_params->cgid = (uint8_t )cfg->cgid; - cmd_params->dest_id =cpu_to_le32 (cfg->dest_cfg.dest_id); +if (cfg->cg_point ==DPNI_CP_CONGESTION_GROUP ) + cmd_params->cgid = (uint8_t )cfg->cgid; +if (cfg->dest_cfg.dest_type !=DPNI_DEST_NONE ) { + cmd_params->dest_id =cpu_to_le32 (cfg- > dest_cfg.dest_id); + cmd_params->dest_priority = cfg->dest_cfg.priority; + }[Hemant] what was the exact issues you are facing in this piece of code? Please share your compiler and other env details.
Quoted 3 lines
drivers/net/dpaa2/mc/dpni.c int dpni_set_congestion_notification(struct · line 1812
Quoted 3 lines
drivers/net/dpaa2/mc/dpni.c +0
-1cmd_params->notification_mode =cpu_to_le16 (cfg- > notification_mode); - cmd_params->dest_priority = cfg->dest_cfg.priority;
That was warning from compiler that neither of these:
- cfg->cgid
- cfg->dest_cfg.dest_id
- cfg->dest_cfg.dest_priority
is initialized in dpaa2_dev_tx_queue_setup() where this function is called and they are used here. This might be non issue - I've changed the function here however since I though it would be better - but I don't know this code, I'm just guessing that:
- cgid is meaningful only when cg_point is DPNI_CP_CONGESTION_GROUP
- dest_id/dest_priority are meaningful when dest_type is not DPNI_DEST_NONE.
That was developed on 19.05 and rebased to 19.11 and I was using gcc (7.4) however today when I commented out those 'if' I did not got the warning which I wanted to send here. I'll try to figure out what has changed that this is no longer reported (I think the compiler should still report this).
Best regards
Andrzej
BTW. In my original submission I've made a mistake with DPDK dev e-mail, so I'm replying now with it corrected.