Fix fallout from r366811.

PR:		250442
Reported by:	lwhsu
Reviewed by:	mav
MFC after:	2 weeks
Sponsored by:	NetApp, Inc.
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D26855
This commit is contained in:
Edward Tomasz Napierala 2020-10-19 20:26:37 +00:00
parent 6b7ecdcd9d
commit 3001e97deb
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=366855
2 changed files with 14 additions and 7 deletions

View File

@ -346,9 +346,15 @@ g_dev_taste(struct g_class *mp, struct g_provider *pp, int insist __unused)
cp->private = sc;
cp->flags |= G_CF_DIRECT_SEND | G_CF_DIRECT_RECEIVE;
error = g_attach(cp, pp);
KASSERT(error == 0 || error == ENXIO,
("g_dev_taste(%s) failed to g_attach, err=%d", pp->name, error));
if (error != 0) {
printf("%s: g_dev_taste(%s) failed to g_attach, error=%d\n",
__func__, pp->name, error);
g_destroy_consumer(cp);
g_destroy_geom(gp);
mtx_destroy(&sc->sc_mtx);
g_free(sc);
return (NULL);
}
make_dev_args_init(&args);
args.mda_flags = MAKEDEV_CHECKNAME | MAKEDEV_WAITOK;
args.mda_devsw = &g_dev_cdevsw;

View File

@ -707,11 +707,11 @@ g_uzip_taste(struct g_class *mp, struct g_provider *pp, int flags)
gp = g_new_geomf(mp, GUZ_DEV_NAME("%s"), pp->name);
cp = g_new_consumer(gp);
error = g_attach(cp, pp);
if (error == 0)
error = g_access(cp, 1, 0, 0);
if (error) {
if (error != 0)
goto e0;
error = g_access(cp, 1, 0, 0);
if (error)
goto e1;
}
g_topology_unlock();
/*
@ -942,6 +942,7 @@ g_uzip_taste(struct g_class *mp, struct g_provider *pp, int flags)
g_access(cp, -1, 0, 0);
e1:
g_detach(cp);
e0:
g_destroy_consumer(cp);
g_destroy_geom(gp);