Re: [PATCH 01/18] drivers core: Add I/O ASID allocator

Christoph Hellwig
2019-04-09T10:04:41Z

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. In general
we expect *free* to deal with NULL pointers transparently, so we
should do so here as well.