[Cocci] spatch defect: C90 initializers?

Joe Perches joe at perches.com
Thu Sep 9 07:32:44 CEST 2010


$ cat find_pci_name.cocci
@@
struct pci_driver * I;
@@

* I->name
$

The cocci script above does not find pci_driver->name references
that are set by c90 initializers like:

$ grep "struct pci_driver atl1_driver" drivers/net/atlx/atl1.c -A 8
drivers/net/atlx/atl1.c:static struct pci_driver atl1_driver = {
drivers/net/atlx/atl1.c-	.name = ATLX_DRIVER_NAME,
drivers/net/atlx/atl1.c-	.id_table = atl1_pci_tbl,
drivers/net/atlx/atl1.c-	.probe = atl1_probe,
drivers/net/atlx/atl1.c-	.remove = __devexit_p(atl1_remove),
drivers/net/atlx/atl1.c-	.suspend = atl1_suspend,
drivers/net/atlx/atl1.c-	.resume = atl1_resume,
drivers/net/atlx/atl1.c-	.shutdown = atl1_shutdown
drivers/net/atlx/atl1.c-};

$ cocci -sp_file find_pci_name.cocci drivers/net/atlx/atl1.c
init_defs_builtins: /usr/local/share/coccinelle/standard.h
HANDLING: drivers/net/atlx/atl1.c
$



More information about the Cocci mailing list