Don't check for impossible NULL return from malloc(..., M_WAITOK).

This commit is contained in:
Ian Lepore 2018-04-07 21:31:09 +00:00
parent 9edf7bc8d3
commit e973ad2298

View File

@ -242,15 +242,9 @@ spigen_transfer(struct cdev *cdev, struct spigen_transfer *st)
#endif
transfer.tx_cmd = transfer.rx_cmd = malloc(st->st_command.iov_len,
M_DEVBUF, M_WAITOK);
if (transfer.tx_cmd == NULL)
return (ENOMEM);
if (st->st_data.iov_len > 0) {
transfer.tx_data = transfer.rx_data = malloc(st->st_data.iov_len,
M_DEVBUF, M_WAITOK);
if (transfer.tx_data == NULL) {
free(transfer.tx_cmd, M_DEVBUF);
return (ENOMEM);
}
}
else
transfer.tx_data = transfer.rx_data = NULL;