On 06/19/2017 03:55 AM, Dan Carpenter wrote:
External Email Hello Igor Mitsyanko, The patch 98f44cb0655c: "qtnfmac: introduce new FullMAC driver for Quantenna chipsets" from May 11, 2017, leads to the following static checker warning: drivers/net/wireless/quantenna/qtnfmac/pearl/pcie.c:285 qtnf_pcie_init_dma_mask() info: return a literal instead of 'ret' drivers/net/wireless/quantenna/qtnfmac/pearl/pcie.c 277 static int 278 qtnf_pcie_init_dma_mask(struct qtnf_pcie_bus_priv *priv, u64 dma_mask) 279 { 280 int ret; 281 282 ret = dma_supported(&priv->pdev->dev, dma_mask); 283 if (!ret) { 284 pr_err("DMA mask %llu not supported\n", dma_mask); 285 return ret; We should probably return a negative? It's also possible that returning zero is intended but then we should use a literal so it's more clearly deliberate.
Hello Dan, it is indeed a bug, 0 is not expected in case of error. Will fix, thanks!
286 } 287 288 ret = pci_set_dma_mask(priv->pdev, dma_mask); 289 if (ret) { 290 pr_err("failed to set DMA mask %llu\n", dma_mask); 291 return ret; 292 } 293 294 ret = pci_set_consistent_dma_mask(priv->pdev, dma_mask); 295 if (ret) { 296 pr_err("failed to set consistent DMA mask %llu\n", dma_mask); 297 return ret; 298 } 299 300 return ret; 301 } regards, dan carpenter