From owner-svn-src-all@FreeBSD.ORG Tue Aug 14 05:31:31 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 92D971065672; Tue, 14 Aug 2012 05:31:31 +0000 (UTC) (envelope-from hselasky@c2i.net) Received: from swip.net (mailfe08.c2i.net [212.247.154.226]) by mx1.freebsd.org (Postfix) with ESMTP id 82F178FC14; Tue, 14 Aug 2012 05:31:29 +0000 (UTC) X-T2-Spam-Status: No, hits=-1.0 required=5.0 tests=ALL_TRUSTED Received: from [176.74.212.201] (account mc467741@c2i.net HELO laptop015.hselasky.homeunix.org) by mailfe08.swip.net (CommuniGate Pro SMTP 5.4.4) with ESMTPA id 308528831; Tue, 14 Aug 2012 07:31:22 +0200 From: Hans Petter Selasky To: John Baldwin Date: Tue, 14 Aug 2012 07:31:58 +0200 User-Agent: KMail/1.13.7 (FreeBSD/9.1-PRERELEASE; KDE/4.8.4; amd64; ; ) References: <201208101502.q7AF2ofC046316@svn.freebsd.org> <201208132143.42298.hselasky@c2i.net> <201208131700.25822.jhb@freebsd.org> In-Reply-To: <201208131700.25822.jhb@freebsd.org> X-Face: 'mmZ:T{)),Oru^0c+/}w'`gU1$ubmG?lp!=R4Wy\ELYo2)@'UZ24N@ =?iso-8859-1?q?d2+AyewRX=7DmAm=3BYp=0A=09=7CU=5B?=@, _z/([?1bCfM{_"B<.J>mICJCHAzzGHI{y7{%JVz%R~yJHIji`y> =?iso-8859-1?q?Y=7Dk1C4TfysrsUI=0A=09-=25GU9V5=5DiUZF=26nRn9mJ=27=3F=26?=>O MIME-Version: 1.0 Content-Type: Text/Plain; charset="windows-1252" Content-Transfer-Encoding: 7bit Message-Id: <201208140731.58979.hselasky@c2i.net> Cc: "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" Subject: Re: svn commit: r239178 - in head/sys: kern sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Aug 2012 05:31:31 -0000 On Monday 13 August 2012 23:00:25 John Baldwin wrote: > int > foo_attach(device_t dev) > { > struct foo_softc *sc; > > sc = malloc(sizeof(struct foo_softc), M_BUS, M_WAITOK | M_ZERO); > device_set_softc(dev, sc); > ... Hi, Here you forget that there are alot of else/if's that need free(sc, M_BUS) for various failing cases! That's why I say +5 lines. BTW: If we do add device_free_softc, would it be an idea to add device_alloc_softc aswell, to make stuff more clear for the drivers? --HPS