| // SPDX-License-Identifier: GPL-2.0 |
| /// Find missing put_device for every of_find_device_by_node. |
| // Copyright: (C) 2018-2019 Wen Yang, ZTE. |
| // Options: --no-includes --include-headers |
| id = of_find_device_by_node@p1(x) |
| if (id == NULL || ...) { ... return ...; } |
| ... when != put_device(&id->dev) |
| when != platform_device_put(id) |
| when != if (id) { ... put_device(&id->dev) ... } |
| when != e1 = (T)(&id->dev) |
| when != e1 = get_device(&id->dev) |
| when != e1 = (T1)platform_get_drvdata(id) |
| | (T2)dev_get_drvdata(&id->dev) |
| | (T3)platform_get_drvdata(id) |
| @script:python depends on report@ |
| coccilib.report.print_report(p2[0], |
| "ERROR: missing put_device; call of_find_device_by_node on line " |
| + ", but without a corresponding object release within this function.") |
| @script:python depends on org@ |
| cocci.print_main("of_find_device_by_node", p1) |
| cocci.print_secs("needed put_device", p2) |