Add missing NULL check after malloc(M_NOWAIT).

Submitted by:	Dmitry Luhtionov <dmitryluhtionov@gmail.com>
This commit is contained in:
Alexander Motin 2013-07-25 09:12:46 +00:00
parent ffacde9be5
commit f5866522ce

View File

@ -287,6 +287,10 @@ ata_promise_chipinit(device_t dev)
/* setup host packet controls */
hpkt = malloc(sizeof(struct ata_promise_sx4),
M_ATAPCI, M_NOWAIT | M_ZERO);
if (hpkt == NULL) {
device_printf(dev, "Cannot allocate HPKT\n");
goto failnfree;
}
mtx_init(&hpkt->mtx, "ATA promise HPKT lock", NULL, MTX_DEF);
TAILQ_INIT(&hpkt->queue);
hpkt->busy = 0;