On Wed, Apr 17, 2024 at 05:38:05PM +0200, Niklas Cassel wrote: > On Wed, Apr 17, 2024 at 03:47:48PM +0300, Dan Carpenter wrote: > > Hello Manivannan Sadhasivam, > > > > Commit a01e7214bef9 ("PCI: endpoint: Remove "core_init_notifier" > > flag") from Mar 27, 2024 (linux-next), leads to the following Smatch > > static checker warning: > > > > drivers/pci/endpoint/functions/pci-epf-test.c:784 pci_epf_test_core_init() > > error: we previously assumed 'epc_features' could be null (see line 747) > > > > drivers/pci/endpoint/functions/pci-epf-test.c > > 734 static int pci_epf_test_core_init(struct pci_epf *epf) > > 735 { > > 736 struct pci_epf_test *epf_test = epf_get_drvdata(epf); > > 737 struct pci_epf_header *header = epf->header; > > 738 const struct pci_epc_features *epc_features; > > 739 struct pci_epc *epc = epf->epc; > > 740 struct device *dev = &epf->dev; > > 741 bool linkup_notifier = false; > > 742 bool msix_capable = false; > > 743 bool msi_capable = true; > > 744 int ret; > > We check pci_epc_get_features() in ->bind(), which comes before ->core_init() > so in practice, this shouldn't be able to be NULL here. > Right. > > > 745 > > 746 epc_features = pci_epc_get_features(epc, epf->func_no, epf->vfunc_no); > > 747 if (epc_features) { > > ^^^^^^^^^^^^ > > epc_features can be NULL > > We should probably just chge this to: > > """ > if (!epc_features) > return some_error; > > msix_capable = epc_features->msix_capable; > msi_capable = epc_features->msi_capable; > """ > > Such that we don't need another check further down for linkup_notifier. > No. We should just remove this NULL check since the check is already present in bind(). - Mani -- மணிவண்ணன் சதாசிவம்