From owner-svn-src-stable-8@FreeBSD.ORG Wed May 11 04:46:33 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BC21E106564A; Wed, 11 May 2011 04:46:33 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8FBA98FC0A; Wed, 11 May 2011 04:46:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4B4kXFx074077; Wed, 11 May 2011 04:46:33 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4B4kXjk074075; Wed, 11 May 2011 04:46:33 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201105110446.p4B4kXjk074075@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Wed, 11 May 2011 04:46:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221754 - stable/8/sys/geom/cache X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 May 2011 04:46:33 -0000 Author: ae Date: Wed May 11 04:46:33 2011 New Revision: 221754 URL: http://svn.freebsd.org/changeset/base/221754 Log: MFC r221446: Remove unneeded checks, g_new_xxx functions can not fail. Modified: stable/8/sys/geom/cache/g_cache.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/cache/g_cache.c ============================================================================== --- stable/8/sys/geom/cache/g_cache.c Wed May 11 00:52:41 2011 (r221753) +++ stable/8/sys/geom/cache/g_cache.c Wed May 11 04:46:33 2011 (r221754) @@ -499,12 +499,6 @@ g_cache_create(struct g_class *mp, struc } gp = g_new_geomf(mp, md->md_name); - if (gp == NULL) { - G_CACHE_DEBUG(0, "Cannot create geom %s.", md->md_name); - return (NULL); - } - gp->softc = NULL; /* for a moment */ - sc = g_malloc(sizeof(*sc), M_WAITOK | M_ZERO); sc->sc_type = type; sc->sc_bshift = bshift; @@ -525,10 +519,6 @@ g_cache_create(struct g_class *mp, struc gp->dumpconf = g_cache_dumpconf; newpp = g_new_providerf(gp, "cache/%s", gp->name); - if (newpp == NULL) { - G_CACHE_DEBUG(0, "Cannot create provider cache/%s.", gp->name); - goto fail; - } newpp->sectorsize = pp->sectorsize; newpp->mediasize = pp->mediasize; if (type == G_CACHE_TYPE_AUTOMATIC) @@ -536,35 +526,20 @@ g_cache_create(struct g_class *mp, struc sc->sc_tail = BNO2OFF(OFF2BNO(newpp->mediasize, sc), sc); cp = g_new_consumer(gp); - if (cp == NULL) { - G_CACHE_DEBUG(0, "Cannot create consumer for %s.", gp->name); - goto fail; - } if (g_attach(cp, pp) != 0) { G_CACHE_DEBUG(0, "Cannot attach to provider %s.", pp->name); - goto fail; + g_destroy_consumer(cp); + g_destroy_provider(newpp); + mtx_destroy(&sc->sc_mtx); + g_free(sc); + g_destroy_geom(gp); + return (NULL); } g_error_provider(newpp, 0); G_CACHE_DEBUG(0, "Device %s created.", gp->name); callout_reset(&sc->sc_callout, g_cache_timeout * hz, g_cache_go, sc); return (gp); -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) { - mtx_destroy(&sc->sc_mtx); - g_free(gp->softc); - } - g_destroy_geom(gp); - } - return (NULL); } static int