dma: use canonical getline() loop
getline() returns -1 on erorr or EOF, so use that condition instead of
feof() and check that there was no error after the loop exits.
Reviewed by: bapt, kevans (both earlier)
MFC after: 3 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34159
(cherry picked from commit d21e71efce3963b068ccaa807a099b591dc220e9)
(cherry picked from commit 2e8403e0215868a13e2bdd1c979fc351971b8d91)