On Tue, Apr 09, 2019 at 03:04:36AM -0700, Christoph Hellwig wrote: > On Tue, Apr 09, 2019 at 01:00:49PM +0300, Andriy Shevchenko wrote: > > I think it makes sense to add a helper macro to rcupdate.h > > (and we have several cases in kernel that can utilize it) > > > > #define kfree_non_null_rcu(ptr, rcu_head) \ > > do { \ > > if (ptr) \ > > kfree_rcu(ptr, rcu_head); \ > > } while (0) > > > > as a more common pattern for resource deallocators. > > I think that should move straight into kfree_rcu.
Possible. I didn't dare to offer this due to lack of knowledge how it's used in other places. > In general > we expect *free* to deal with NULL pointers transparently, so we > should do so here as well. Exactly my point, thanks. -- With Best Regards, Andy Shevchenko _______________________________________________ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu