From: Andriy Shevchenko Subject: Re: [PATCH 01/18] drivers core: Add I/O ASID allocator Date: Tue, 9 Apr 2019 13:30:30 +0300 Message-ID: <20190409103030.GK9224@smile.fi.intel.com> References: <1554767973-30125-1-git-send-email-jacob.jun.pan@linux.intel.com> <1554767973-30125-2-git-send-email-jacob.jun.pan@linux.intel.com> <20190409100049.GC9224@smile.fi.intel.com> <20190409100436.GA28683@infradead.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: <20190409100436.GA28683@infradead.org> Sender: linux-kernel-owner@vger.kernel.org To: Christoph Hellwig Cc: Jacob Pan , iommu@lists.linux-foundation.org, LKML , Joerg Roedel , David Woodhouse , Alex Williamson , Jean-Philippe Brucker , Yi Liu , "Tian, Kevin" , Raj Ashok , Lu Baolu , "Paul E. McKenney" List-Id: iommu@lists.linux-foundation.org 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