From: Christoph Hellwig Subject: Re: [PATCH 01/18] drivers core: Add I/O ASID allocator Date: Tue, 9 Apr 2019 03:04:36 -0700 Message-ID: <20190409100436.GA28683@infradead.org> 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> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <20190409100049.GC9224-XvqNBM/wLWRrdx17CPfAsdBPR1lH4CV8@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: iommu-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org Errors-To: iommu-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org To: Andriy Shevchenko Cc: "Tian, Kevin" , Raj Ashok , Jean-Philippe Brucker , iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org, LKML , Alex Williamson , "Paul E. McKenney" , David Woodhouse List-Id: iommu@lists.linux-foundation.org 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.