Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  1) // SPDX-License-Identifier: GPL-2.0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  2) /// Find missing put_device for every of_find_device_by_node.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  3) ///
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  4) // Confidence: Moderate
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  5) // Copyright: (C) 2018-2019 Wen Yang, ZTE.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  6) // Comments:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  7) // Options: --no-includes --include-headers
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  8) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  9) virtual report
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) virtual org
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) @search exists@
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) local idexpression id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) expression x,e,e1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) position p1,p2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) type T,T1,T2,T3;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) @@
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) id = of_find_device_by_node@p1(x)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) ... when != e = id
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) if (id == NULL || ...) { ... return ...; }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) ... when != put_device(&id->dev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23)     when != platform_device_put(id)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24)     when != of_dev_put(id)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25)     when != if (id) { ... put_device(&id->dev) ... }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26)     when != e1 = (T)id
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27)     when != e1 = (T)(&id->dev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28)     when != e1 = get_device(&id->dev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29)     when != e1 = (T1)platform_get_drvdata(id)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) (
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31)   return
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) (    id
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) |    (T2)dev_get_drvdata(&id->dev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) |    (T3)platform_get_drvdata(id)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) |    &id->dev
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) );
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) | return@p2 ...;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) @script:python depends on report@
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) p1 << search.p1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) p2 << search.p2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) @@
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) coccilib.report.print_report(p2[0],
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46)                              "ERROR: missing put_device; call of_find_device_by_node on line "
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47)                              + p1[0].line
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48)                              + ", but without a corresponding object release within this function.")
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) @script:python depends on org@
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) p1 << search.p1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) p2 << search.p2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) @@
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) cocci.print_main("of_find_device_by_node", p1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) cocci.print_secs("needed put_device", p2)