Page MenuHomeFreeBSD

Return errors in bus_dmamap_load
AbandonedPublic

Authored by kjopek_gmail.com on Jan 20 2021, 10:12 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Oct 6, 12:26 AM
Unknown Object (File)
Sat, Oct 5, 11:49 AM
Unknown Object (File)
Fri, Oct 4, 10:42 AM
Unknown Object (File)
Sun, Sep 29, 2:52 PM
Unknown Object (File)
Sun, Sep 29, 11:27 AM
Unknown Object (File)
Sat, Sep 28, 6:32 AM
Unknown Object (File)
Fri, Sep 27, 1:17 AM
Unknown Object (File)
Sep 17 2024, 2:37 AM
Subscribers
None

Details

Reviewers
mmel
manu
kib
Summary

Function bus_dmamap_load returned only two different errors: EINPROGRESS and ENOMEM.
However, some implementations (arm64 notably) provide more errors here. Do not limit set of errors
bus_dmamap_load returns.

While here: hint compiler on fast path in the code.

Test Plan

Tested on RockPro64.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

kjopek_gmail.com created this revision.

Kib, this error handling doesn't make sense to me, so I had to miss something important. Can you, please, explain me the context/reason for this strange kind of errors hiding? Moreover EBIG is also allowed in man page.

sys/kern/subr_bus_dma.c
405

Style. Assuming that this will be applied to all bus_dmamap_load<foo>() variants.

437

(error = 0)

In D28261#632241, @mmel wrote:

Kib, this error handling doesn't make sense to me, so I had to miss something important. Can you, please, explain me the context/reason for this strange kind of errors hiding? Moreover EBIG is also allowed in man page.

EBIG is an error shown to callback. That said, I am not the author of this code and if I blamed for it, perhaps because I moved it around, nothing more.

I am certain that the intent is that callback should consume the error and make required arrangements. Blindly leaking something different than ENOMEM/EINPROGRESS from bus_dmamap_load() potentially breaks callers, they all must be inspected before.