Date: Tue, 14 Aug 2012 07:31:58 +0200 From: Hans Petter Selasky <hselasky@c2i.net> To: John Baldwin <jhb@freebsd.org> Cc: "svn-src-head@freebsd.org" <svn-src-head@freebsd.org>, "svn-src-all@freebsd.org" <svn-src-all@freebsd.org>, "src-committers@freebsd.org" <src-committers@freebsd.org> Subject: Re: svn commit: r239178 - in head/sys: kern sys Message-ID: <201208140731.58979.hselasky@c2i.net> In-Reply-To: <201208131700.25822.jhb@freebsd.org> References: <201208101502.q7AF2ofC046316@svn.freebsd.org> <201208132143.42298.hselasky@c2i.net> <201208131700.25822.jhb@freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201208140731.58979.hselasky>