pcie-rockchip-ep.c coverity issue #1437163
Hi Shawn,
Please take a look at this issue reported by Coverity:
332 static int rockchip_pcie_ep_get_msi(struct pci_epc *epc, u8 fn) 333 {
334 struct rockchip_pcie_ep *ep = epc_get_drvdata(epc); 335 struct rockchip_pcie *rockchip = &ep->rockchip; 336 u16 flags;
337
338 flags = rockchip_pcie_read(rockchip,
339 ROCKCHIP_PCIE_EP_FUNC_BASE(fn) +
340 ROCKCHIP_PCIE_EP_MSI_CTRL_REG);
CID 1437163 (#2 of 2): Operands don't affect result (CONSTANT_EXPRESSION_RESULT) result_independent_of_operands: flags & (65536UL /* 1UL << 16 */) is always 0 regardless of the values of its operands. This occurs as the logical operand of !.
341 if (!(flags & ROCKCHIP_PCIE_EP_MSI_CTRL_ME))
342 return -EINVAL;
Quoted 14 lines · Bjorn Helgaas
Hi Shawn,
Please take a look at this issue reported by Coverity:
332 static int
rockchip_pcie_ep_get_msi(struct pci_epc *epc, u8 fn)333 {334 struct rockchip_pcie_ep *ep = epc_get_drvdata(epc); 335 struct rockchip_pcie *rockchip = &ep->rockchip; 336 u16 flags;337
338 flags = rockchip_pcie_read(rockchip,
339ROCKCHIP_PCIE_EP_FUNC_BASE(fn)+
340ROCKCHIP_PCIE_EP_MSI_CTRL_REG);
Quoted 7 lines
CID 1437163 (#2 of 2): Operands don't affect result (
CONSTANT_EXPRESSION_RESULT)result_independent_of_operands: flags & (65536UL /* 1UL << 16 */) is always 0 regardless of the values of its operands. This occurs as the logical operand of !.341 if (!(flags &
ROCKCHIP_PCIE_EP_MSI_CTRL_ME))
342 return-EINVAL;
The same issue also occurs in rockchip_pcie_ep_send_msi_irq() (Coverity issue #143765 for that one).