其他分享
首页 > 其他分享> > TX2踩坑(二):error: ‘msg.msg_id’ may be used uninitialized in this function [-Werror=maybe-uninitialized

TX2踩坑(二):error: ‘msg.msg_id’ may be used uninitialized in this function [-Werror=maybe-uninitialized

作者:互联网

修改了makefile中的忽略未初始化告警,还是一样有错误.将源文件修改.

/home/hbg/nvidia/Linux_for_Tegra/source/public/kernel_src/kernel/nvidia/drivers/pci/endpoint/functions/pci-epf-tegra-vnet.c: In function ‘tvnet_ep_ctrl_irqsp_callback’:
/home/hbg/nvidia/Linux_for_Tegra/source/public/kernel_src/kernel/nvidia/drivers/pci/endpoint/functions/pci-epf-tegra-vnet.c:670:11: error: ‘msg.msg_id’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
   else if (msg.msg_id == CTRL_MSG_LINK_DOWN_ACK)
           ^
/home/hbg/nvidia/Linux_for_Tegra/source/public/kernel_src/kernel/nvidia/drivers/pci/endpoint/functions/pci-epf-tegra-vnet.c:662:18: note: ‘msg.msg_id’ was declared here
  struct ctrl_msg msg;
==============================================================

/home/hbg/nvidia/Linux_for_Tegra/source/public/kernel_src/kernel/nvidia/drivers/net/ethernet/nvidia/pcie/tegra_vnet.c: In function ‘tvnet_irq_ctrl’:
/home/hbg/nvidia/Linux_for_Tegra/source/public/kernel_src/kernel/nvidia/drivers/net/ethernet/nvidia/pcie/tegra_vnet.c:610:11: error: ‘msg.msg_id’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
   else if (msg.msg_id == CTRL_MSG_LINK_DOWN_ACK)
           ^
/home/hbg/nvidia/Linux_for_Tegra/source/public/kernel_src/kernel/nvidia/drivers/net/ethernet/nvidia/pcie/tegra_vnet.c:602:18: note: ‘msg.msg_id’ was declared here
  struct ctrl_msg msg;

找到相关的源文件,然后使用memset进行初始化.

标签:uninitialized,kernel,drivers,nvidia,msg,home,id
来源: https://www.cnblogs.com/rohens-hbg/p/14808663.html