On Thu, Mar 21, 2024 at 10:59:42AM +0100, Przemek Kitszel wrote: > Simplest solution would be to add a macro wrapper, especially that there > are only a few deallocation methods. > > in cleanup.h: > +#define auto_kfree __free(kfree) = NULL > > and similar macros for auto vfree(), etc. > > then in the drivers: > -struct ice_aqc_get_phy_caps_data *pcaps __free(kfree) = NULL, > *othercaps __free(kfree) = NULL; > +struct ice_aqc_get_phy_caps_data *pcaps auto_kfree, > *othercaps auto_kfree; The auto_kfree looks like a variable to my eyes. I'd prefer something like: #define __FREE(p) p __free(kfree) = NULL struct ice_aqc_get_phy_caps_data *__FREE(pcaps); regards, dan carpenter