Release the reference to the peripheral if returning a error.

That reference is to be held only if daopen() has been successful
and until daclose() releases it.  daclose() won't be called if
daopen() has failed, though.

Approved by:	re, njl
MFC after:	1 week
This commit is contained in:
Yaroslav Tykhiy 2002-11-29 15:40:10 +00:00
parent ef31810d3f
commit b7c8a7976f

View File

@ -611,6 +611,8 @@ daopen(dev_t dev, int flags __unused, int fmt __unused, struct thread *td __unus
if (error == 0) {
if ((softc->flags & DA_FLAG_PACK_REMOVABLE) != 0)
daprevent(periph, PR_PREVENT);
} else {
cam_periph_release(periph);
}
cam_periph_unlock(periph);
return (error);