Re: [PATCH v5] coccinelle: semantic code search for missing put_device()
From: Markus Elfring
Date: Fri Feb 15 2019 - 04:10:43 EST
> In a function, for a local variable returned by calling
> of_find_device_by_node(),
I suggest to reconsider this information once more.
1. Will an other wording be more appropriate for the storage of
a function return value?
2. Can the restriction âlocalâ be omitted?
3. Will any macros be involved eventually?
> c, for the rest of the situation, the current function should release the
> reference by calling put_device,
Can it happen that on other function will perform the desired reference release?
> this code search will report the
> corresponding error message.
Rewording?
A code search can report an error with a specific confidence.
> v5->v4:
Such version information would be sufficient also without arrows, wouldn't it?
> - add a SPDX identifierfix
Would you like to fix a typo at the end?
> +@script:python depends on report@
> +p1 << search.p1;
> +p2 << search.p2;
> +@@
> +
> +coccilib.report.print_report(p2[0], "ERROR: missing put_device; "
> + + "call of_find_device_by_node on line "
> + + p1[0].line
> + + ", but without a corresponding object release "
> + + "within this function.")
I find your interpretation of my reminder for the preferred avoidance
of split string literals interesting somehow.
Can the following source code variant be more appropriate?
+coccilib.report.print_report(p2[0],
+ "WARNING: missing put_device - of_find_device_by_node() call on line "
+ + p1[0].line
+ + ", but without a corresponding object release within this function.")
Will any more advanced error diagnostics be eventually developed?
Regards,
Markus