Author: ae
Date: Thu Apr  7 05:58:21 2011
New Revision: 220407
URL: http://svn.freebsd.org/changeset/base/220407

Log:
  MFC r220184:
    Remove unneeded checks, g_new_xxx functions can not return NULL.

Modified:
  stable/8/sys/geom/nop/g_nop.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)

Modified: stable/8/sys/geom/nop/g_nop.c
==============================================================================
--- stable/8/sys/geom/nop/g_nop.c       Thu Apr  7 03:19:10 2011        
(r220406)
+++ stable/8/sys/geom/nop/g_nop.c       Thu Apr  7 05:58:21 2011        
(r220407)
@@ -189,10 +189,6 @@ g_nop_create(struct gctl_req *req, struc
                }
        }
        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, struc
        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, struc
        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);
 }
 
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to