Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 4 May 2011 18:17:21 +0000 (UTC)
From:      "Andrey V. Elsukov" <ae@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r221451 - head/sys/geom/mountver
Message-ID:  <201105041817.p44IHLeg061947@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ae
Date: Wed May  4 18:17:21 2011
New Revision: 221451
URL: http://svn.freebsd.org/changeset/base/221451

Log:
  Remove unneeded code.
  
  MFC after:	1 week

Modified:
  head/sys/geom/mountver/g_mountver.c

Modified: head/sys/geom/mountver/g_mountver.c
==============================================================================
--- head/sys/geom/mountver/g_mountver.c	Wed May  4 18:16:05 2011	(r221450)
+++ head/sys/geom/mountver/g_mountver.c	Wed May  4 18:17:21 2011	(r221451)
@@ -248,10 +248,6 @@ g_mountver_create(struct gctl_req *req, 
 		}
 	}
 	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 | M_ZERO);
 	mtx_init(&sc->sc_mtx, "gmountver", NULL, MTX_DEF);
 	TAILQ_INIT(&sc->sc_queue);
@@ -263,20 +259,10 @@ g_mountver_create(struct gctl_req *req, 
 	gp->dumpconf = g_mountver_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 = pp->mediasize;
 	newpp->sectorsize = pp->sectorsize;
 
 	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);
@@ -303,20 +289,13 @@ g_mountver_create(struct gctl_req *req, 
 	G_MOUNTVER_DEBUG(0, "Device %s created.", gp->name);
 	return (0);
 fail:
-	if (sc->sc_provider_name != NULL)
-		g_free(sc->sc_provider_name);
-	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);
-	}
+	g_free(sc->sc_provider_name);
+	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);
 }
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201105041817.p44IHLeg061947>