Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S263230AbUCNAer (ORCPT ); Sat, 13 Mar 2004 19:34:47 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S263234AbUCNAer (ORCPT ); Sat, 13 Mar 2004 19:34:47 -0500 Received: from fw.osdl.org ([65.172.181.6]:61861 "EHLO mail.osdl.org") by vger.kernel.org with ESMTP id S263230AbUCNAep (ORCPT ); Sat, 13 Mar 2004 19:34:45 -0500 Date: Sat, 13 Mar 2004 16:34:51 -0800 From: Andrew Morton To: Greg KH Cc: linux-kernel@vger.kernel.org Subject: Re: [RFC] kref, a tiny, sane, reference count object Message-Id: <20040313163451.3c841ac2.akpm@osdl.org> In-Reply-To: <20040313082003.GA13084@kroah.com> References: <20040313082003.GA13084@kroah.com> X-Mailer: Sylpheed version 0.9.7 (GTK+ 1.2.10; i386-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 669 Lines: 28 Greg KH wrote: > > For all of those people, this patch is for you. It does rather neatly capture a common idiom. > +struct kref * kref_get(struct kref *kref) > +{ > + if (kref) { > + WARN_ON(!atomic_read(&kref->refcount)); > + atomic_inc(&kref->refcount); > + } > + return kref; > +} Why is a NULL arg permitted here? > +void kref_cleanup(struct kref *kref) > +{ > + if (!kref) > + return; and here? - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/