Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 11 May 2011 04:53:57 +0000 (UTC)
From:      "Andrey V. Elsukov" <ae@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
Subject:   svn commit: r221756 - in stable/8/sys/geom: multipath sched
Message-ID:  <201105110453.p4B4rvIi074390@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ae
Date: Wed May 11 04:53:56 2011
New Revision: 221756
URL: http://svn.freebsd.org/changeset/base/221756

Log:
  MFC r221452,221453:
    Remove unneeded code.

Modified:
  stable/8/sys/geom/multipath/g_multipath.c
  stable/8/sys/geom/sched/g_sched.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/multipath/g_multipath.c
==============================================================================
--- stable/8/sys/geom/multipath/g_multipath.c	Wed May 11 04:48:03 2011	(r221755)
+++ stable/8/sys/geom/multipath/g_multipath.c	Wed May 11 04:53:56 2011	(r221756)
@@ -292,9 +292,6 @@ g_multipath_create(struct g_class *mp, s
 	}
 
 	gp = g_new_geomf(mp, md->md_name);
-	if (gp == NULL)
-		goto fail;
-
 	sc = g_malloc(sizeof(*sc), M_WAITOK | M_ZERO);
 	gp->softc = sc;
 	gp->start = g_multipath_start;
@@ -304,21 +301,12 @@ g_multipath_create(struct g_class *mp, s
 	memcpy(sc->sc_name, md->md_name, sizeof (sc->sc_name));
 
 	pp = g_new_providerf(gp, "multipath/%s", md->md_name);
-	if (pp == NULL)
-		goto fail;
 	/* limit the provider to not have it stomp on metadata */
 	pp->mediasize = md->md_size - md->md_sectorsize;
 	pp->sectorsize = md->md_sectorsize;
 	sc->pp = pp;
 	g_error_provider(pp, 0);
 	return (gp);
-fail:
-	if (gp != NULL) {
-		if (gp->softc != NULL)
-			g_free(gp->softc);
-		g_destroy_geom(gp);
-	}
-	return (NULL);
 }
 
 static int
@@ -347,8 +335,6 @@ g_multipath_add_disk(struct g_geom *gp, 
 	}
 	nxtcp = LIST_FIRST(&gp->consumer);
 	cp = g_new_consumer(gp);
-	if (cp == NULL)
-		return (ENOMEM);
 	error = g_attach(cp, pp);
 	if (error != 0) {
 		printf("GEOM_MULTIPATH: cannot attach %s to %s",

Modified: stable/8/sys/geom/sched/g_sched.c
==============================================================================
--- stable/8/sys/geom/sched/g_sched.c	Wed May 11 04:48:03 2011	(r221755)
+++ stable/8/sys/geom/sched/g_sched.c	Wed May 11 04:53:56 2011	(r221756)
@@ -1004,11 +1004,6 @@ g_sched_create(struct gctl_req *req, str
 
 	gp = g_new_geomf(mp, name);
 	dstgp = proxy ? pp->geom : gp; /* where do we link the provider */
-	if (gp == NULL) {
-		gctl_error(req, "Cannot create geom %s.", name);
-		error = ENOMEM;
-		goto fail;
-	}
 
 	sc = g_malloc(sizeof(*sc), M_WAITOK | M_ZERO);
 	sc->sc_gsched = gsp;
@@ -1034,23 +1029,10 @@ g_sched_create(struct gctl_req *req, str
 	gp->dumpconf = g_sched_dumpconf;
 
 	newpp = g_new_providerf(dstgp, 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, proxy ? newpp : pp);
 	if (error != 0) {
 		gctl_error(req, "Cannot attach to provider %s.",
@@ -1076,23 +1058,15 @@ fail:
 			g_detach(cp);
 		g_destroy_consumer(cp);
 	}
-
 	if (newpp != NULL)
 		g_destroy_provider(newpp);
-
-	if (sc && sc->sc_hash) {
+	if (sc->sc_hash)
 		g_sched_hash_fini(gp, sc->sc_hash, sc->sc_mask,
 		    gsp, sc->sc_data);
-	}
-
-	if (sc && sc->sc_data)
+	if (sc->sc_data)
 		gsp->gs_fini(sc->sc_data);
-
-	if (gp != NULL) {
-		if (gp->softc != NULL)
-			g_free(gp->softc);
-		g_destroy_geom(gp);
-	}
+	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?201105110453.p4B4rvIi074390>