[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <24b3851a-b5c4-4c53-950f-bb5da1a32e11@web.de>
Date: Thu, 18 Apr 2024 20:08:21 +0200
From: Markus Elfring <Markus.Elfring@....de>
To: Wander Lairson Costa <wander@...hat.com>, kunit-dev@...glegroups.com,
linux-kselftest@...r.kernel.org, kernel-janitors@...r.kernel.org,
Brendan Higgins <brendan.higgins@...ux.dev>, David Gow
<davidgow@...gle.com>, Rae Moar <rmoar@...gle.com>
Cc: LKML <linux-kernel@...r.kernel.org>
Subject: Re: [ 2/2] kunit: avoid memory leak on device register error
>> Common error handling code can be used instead
>> if an additional label would be applied for a corresponding jump target.
>>
>> How do you think about to increase the application of scope-based resource management here?
>
> I thought about that. But I think the code is simple enough (for now)
> to not require an exit label.
Please follow a known advice (besides other recommended improvements).
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