[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <8175d102-e1ba-4956-a54a-e734f4d99ecf@web.de>
Date: Wed, 3 Jan 2024 08:56:50 +0100
From: Markus Elfring <Markus.Elfring@....de>
To: Tzung-Bi Shih <tzungbi@...nel.org>, chrome-platform@...ts.linux.dev,
kernel-janitors@...r.kernel.org
Cc: Benson Leung <bleung@...omium.org>, Günter Röck
<groeck@...omium.org>, LKML <linux-kernel@...r.kernel.org>
Subject: Re: platform/chrome: cros_ec_i2c: Less function calls in
cros_ec_cmd_xfer_i2c() after error detection
>> The kfree() function was called in up to two cases by
>> the cros_ec_cmd_xfer_i2c() function during error handling
>> even if the passed variable contained a null pointer.
>> This issue was detected by using the Coccinelle software.
>>
>> * Adjust jump targets.
>>
>> * Delete two initialisations which became unnecessary
>> with this refactoring.
>
> The patch saves few instructions but makes the code less readable a bit.
Do you find advices applicable from another information source
also for this function implementation?
https://wiki.sei.cmu.edu/confluence/display/c/MEM12-C.+Consider+using+a+goto+chain+when+leaving+a+function+on+error+when+using+and+releasing+resources
Regards,
Markus
Powered by blists - more mailing lists