[PATCH 0/7] drivers: Simplify cleanup paths using __free

Sanjay Chitroda sanjayembeddedse at gmail.com
Tue Mar 10 18:57:18 PDT 2026



On 11 March 2026 3:22:28 am IST, David Lechner <dlechner at baylibre.com> wrote:
>On 3/10/26 3:05 PM, Sanjay Chitroda wrote:
>> From: Sanjay Chitroda <sanjayembeddedse at gmail.com>
>> 
>> Hi all,
>> 
>> This patch series replaces manual cleanup and explicit kfree() calls with
>> the __free attribute from <linux/cleanup.h>. This modernizes the memory
>> management style and simplifies common error paths without altering any
>> functional behavior.
>> 
>> The __free attribute provides automatic scope-based cleanup, making
>> resource management clearer and reducing the chances of missing cleanup
>> on early returns.
>> 
>> No functional changes are intended in this series.
>> 
>> Testing:
>>   - Compiled with W=1
>>   - Build-tested on i86_64
>> 
>> Based on:
>>   <linux-v7.0-rc2>
>> 
>> Feel free to share your valuable input in context of the cleanup API.
>> 
>> Thanks,
>> Sanjay Chitroda
>> 
>> Sanjay Chitroda (7):
>>   staging: greybus: simplify cleanup using __free
>>   iio: ssp_sensors: simplify cleanup using __free
>>   iio: st_sensors: simplify cleanup using __free
>>   media: mediatek: vcodec: simplify cleanup using __free
>>   media: chips-media: coda: simplify cleanup using __free
>>   media: allegro: simplify cleanup using __free
>>   staging: rtl8723bs: simplify cleanup using __free
>
>There is no reason to put patches from different subsystems
>in the same series when there is no dependency between them.
>It just make for more noise for everyone.
>

Thanks for the feedback. I will split unrelated patches into
separate series per subsystem or individual in future submissions.



More information about the Linux-mediatek mailing list