diff options
author | pjd <pjd@FreeBSD.org> | 2004-06-24 10:50:20 +0000 |
---|---|---|
committer | pjd <pjd@FreeBSD.org> | 2004-06-24 10:50:20 +0000 |
commit | 3483cf533729882a1079e524b585bde782f17c31 (patch) | |
tree | 9a50f9a8a2544a3bdbd752c6294e61ec050530ad /sys/geom/geom_slice.c | |
parent | b1dd8c1222fd2c0b321bc0f627ae248bb9c08268 (diff) | |
download | FreeBSD-src-3483cf533729882a1079e524b585bde782f17c31.zip FreeBSD-src-3483cf533729882a1079e524b585bde782f17c31.tar.gz |
Don't force class to give a valid softc to g_slice_new(), it is not always
needed.
Approved by: phk
Diffstat (limited to 'sys/geom/geom_slice.c')
-rw-r--r-- | sys/geom/geom_slice.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/sys/geom/geom_slice.c b/sys/geom/geom_slice.c index 8a76910..95312c0 100644 --- a/sys/geom/geom_slice.c +++ b/sys/geom/geom_slice.c @@ -62,7 +62,10 @@ g_slice_alloc(unsigned nslice, unsigned scsize) struct g_slicer *gsp; gsp = g_malloc(sizeof *gsp, M_WAITOK | M_ZERO); - gsp->softc = g_malloc(scsize, M_WAITOK | M_ZERO); + if (scsize > 0) + gsp->softc = g_malloc(scsize, M_WAITOK | M_ZERO); + else + gsp->softc = NULL; gsp->slices = g_malloc(nslice * sizeof(struct g_slice), M_WAITOK | M_ZERO); gsp->nslice = nslice; @@ -468,7 +471,8 @@ g_slice_new(struct g_class *mp, u_int slices, struct g_provider *pp, struct g_co g_wither_geom(gp, ENXIO); return (NULL); } - *vp = gsp->softc; + if (extrap != NULL) + *vp = gsp->softc; *cpp = cp; return (gp); } |