On Tue, Mar 10, 2026 at 11:07:16PM +0200, Andy Shevchenko wrote:
On Wed, Mar 11, 2026 at 01:35:07AM +0530, Sanjay Chitroda wrote:
Replace manual cleanup logic with __free attribute from cleanup.h. This removes explicit kfree() calls and simplifies the error handling paths.
No functional change intended for kmalloc().
...
- struct gb_camera_configure_streams_request *req __free(kfree) =
kmalloc(req_size, GFP_KERNEL);- struct gb_camera_configure_streams_response *resp __free(kfree) =
if (!req || !resp) {kmalloc(resp_size, GFP_KERNEL);Now this check should be done in a better way.
Yeah, two if statements, right? Drop the curly braces at a minimum.
kfree(req); return -ENOMEM; }kfree(resp);done_skip_pm_put: mutex_unlock(&gcam->mutex);
To complete this, one may add a prerequisite to use guard()() first.
I don't think we're encouraging people to re-write existing staging code to use cleanup.h magic... It's unclear if I have to review these patches or if they're auto NAKed because we're not doing the conversions.
regards, dan carpenter