svn commit: r239178 - in head/sys: kern sys
Hans Petter Selasky
hselasky at c2i.net
Tue Aug 14 05:31:31 UTC 2012
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
More information about the svn-src-all
mailing list