The previous commit was bogus. malloc(..., M_WAITOK) should not be

used in device attach routines.  At least for attaches at boot time,
actually waiting, or actually failing for malloc(..., M_NOWAIT), are
almost equally unlikely and harmless, but using M_WAITOK interferes
with automatic detection of bogus M_WAITOK's.
This commit is contained in:
Bruce Evans 1999-01-01 12:35:47 +00:00
parent d82478ba84
commit b55dcca107
2 changed files with 12 additions and 4 deletions

View File

@ -21,7 +21,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: if_fea.c,v 1.10 1998/08/24 02:28:15 bde Exp $
* $Id: if_fea.c,v 1.11 1998/12/09 02:18:53 eivind Exp $
*/
/*
@ -205,7 +205,11 @@ pdq_eisa_attach(
irq = TAILQ_FIRST(&ed->ioconf.irqs)->irq_no;
sc = malloc(sizeof(*sc), M_DEVBUF, M_WAITOK);
sc = malloc(sizeof(*sc), M_DEVBUF, M_NOWAIT);
if (sc == NULL) {
printf("fea%d: malloc failed!\n", ed->unit);
return -1;
}
pdqs_eisa[ed->unit] = sc;
bzero(sc, sizeof(pdq_softc_t)); /* Zero out the softc*/

View File

@ -21,7 +21,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: if_fea.c,v 1.10 1998/08/24 02:28:15 bde Exp $
* $Id: if_fea.c,v 1.11 1998/12/09 02:18:53 eivind Exp $
*/
/*
@ -205,7 +205,11 @@ pdq_eisa_attach(
irq = TAILQ_FIRST(&ed->ioconf.irqs)->irq_no;
sc = malloc(sizeof(*sc), M_DEVBUF, M_WAITOK);
sc = malloc(sizeof(*sc), M_DEVBUF, M_NOWAIT);
if (sc == NULL) {
printf("fea%d: malloc failed!\n", ed->unit);
return -1;
}
pdqs_eisa[ed->unit] = sc;
bzero(sc, sizeof(pdq_softc_t)); /* Zero out the softc*/