> > > > > > > > Signed-off-by: Jonathan Cameron <Jonathan.Cameron@xxxxxxxxxx> > > > --- > > > include/linux/of.h | 2 ++ > > > 1 file changed, 2 insertions(+) > > > > > > diff --git a/include/linux/of.h b/include/linux/of.h > > > index 6a9ddf20e79a..50e882ee91da 100644 > > > --- a/include/linux/of.h > > > +++ b/include/linux/of.h > > > @@ -13,6 +13,7 @@ > > > */ > > > #include <linux/types.h> > > > #include <linux/bitops.h> > > > +#include <linux/cleanup.h> > > > #include <linux/errno.h> > > > #include <linux/kobject.h> > > > #include <linux/mod_devicetable.h> > > > @@ -134,6 +135,7 @@ static inline struct device_node *of_node_get(struct device_node *node) > > > } > > > static inline void of_node_put(struct device_node *node) { } > > > #endif /* !CONFIG_OF_DYNAMIC */ > > > +DEFINE_FREE(device_node, struct device_node *, if (_T) of_node_put(_T)) > > > > of_node_put() can be called with NULL, so do we need the "if (_T)"? > > Nope - should be fine to call it without. I was being lazy and didn't check :) Seems there has been a lot of discussion of this for similar cases and consensus is to keep the if (_T) e.g. https://lore.kernel.org/all/6596edda327c8_8dc68294b2@xxxxxxxxxxxxxxxxxxxxxxxxx.notmuch/ > > > > > Rob > >