>> elfring@Sonne:~/Projekte/Coccinelle/janitor> spatch.opt 
>> show_too_late_checking2.cocci ../Probe/clk-mstp-excerpt1.c
>> init_defs_builtins: /usr/local/lib64/coccinelle/standard.h
>> HANDLING: ../Probe/clk-mstp-excerpt1.c
>> diff =
>> --- ../Probe/clk-mstp-excerpt1.c
>> +++ /tmp/cocci-output-20109-52f048-clk-mstp-excerpt1.c
>> @@ -5,7 +5,6 @@ static void __init cpg_mstp_clocks_init(
>>      struct clk **clks;
>>      unsigned int i;
>>
>> -    group = kzalloc(sizeof(*group), GFP_KERNEL);
>>      clks = kmalloc(MSTP_MAX_CLOCKS * sizeof(*clks), GFP_KERNEL);
>>      if (group == NULL || clks == NULL) {
>>              kfree(group);
>>
>>
>> I imagine that there are further software improvements to consider around
>> such use cases.
> 
> Not sure what you are asking about here.

A bit more explanation can be found in my update suggestion
“[PATCH 3/4] clk/Renesas-MSTP: Less function calls in cpg_mstp_clocks_init()
after error detection” from 2016-09-14.

https://patchwork.kernel.org/patch/9332367/
https://lkml.kernel.org/r/<[email protected]>


> Note that it is unlikely that anyone would accept a patch on the above code.

I would agree because I used the asterisk functionality from the Coccinelle 
software
just to try another source code search pattern out a bit more for test purposes.

I guess that corresponding syntax elements can be clarified further.


> Group is tested before it is used.

But can it be that this assignment is checked a bit too late?

Regards,
Markus
_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci

Reply via email to