summaryrefslogtreecommitdiffstats
path: root/sys/geom/nop/g_nop.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/geom/nop/g_nop.c')
-rw-r--r--sys/geom/nop/g_nop.c32
1 files changed, 6 insertions, 26 deletions
diff --git a/sys/geom/nop/g_nop.c b/sys/geom/nop/g_nop.c
index 9846942..c1a2333 100644
--- a/sys/geom/nop/g_nop.c
+++ b/sys/geom/nop/g_nop.c
@@ -189,10 +189,6 @@ g_nop_create(struct gctl_req *req, struct g_class *mp, struct g_provider *pp,
}
}
gp = g_new_geomf(mp, name);
- if (gp == NULL) {
- gctl_error(req, "Cannot create geom %s.", name);
- return (ENOMEM);
- }
sc = g_malloc(sizeof(*sc), M_WAITOK);
sc->sc_offset = offset;
sc->sc_error = ioerror;
@@ -209,20 +205,10 @@ g_nop_create(struct gctl_req *req, struct g_class *mp, struct g_provider *pp,
gp->dumpconf = g_nop_dumpconf;
newpp = g_new_providerf(gp, gp->name);
- if (newpp == NULL) {
- gctl_error(req, "Cannot create provider %s.", name);
- error = ENOMEM;
- goto fail;
- }
newpp->mediasize = size;
newpp->sectorsize = secsize;
cp = g_new_consumer(gp);
- if (cp == NULL) {
- gctl_error(req, "Cannot create consumer for %s.", gp->name);
- error = ENOMEM;
- goto fail;
- }
error = g_attach(cp, pp);
if (error != 0) {
gctl_error(req, "Cannot attach to provider %s.", pp->name);
@@ -233,18 +219,12 @@ g_nop_create(struct gctl_req *req, struct g_class *mp, struct g_provider *pp,
G_NOP_DEBUG(0, "Device %s created.", gp->name);
return (0);
fail:
- if (cp != NULL) {
- if (cp->provider != NULL)
- g_detach(cp);
- g_destroy_consumer(cp);
- }
- if (newpp != NULL)
- g_destroy_provider(newpp);
- if (gp != NULL) {
- if (gp->softc != NULL)
- g_free(gp->softc);
- g_destroy_geom(gp);
- }
+ if (cp->provider != NULL)
+ g_detach(cp);
+ g_destroy_consumer(cp);
+ g_destroy_provider(newpp);
+ g_free(gp->softc);
+ g_destroy_geom(gp);
return (error);
}
OpenPOWER on IntegriCloud