Page MenuHomeFreeBSD

usb: malloc with M_WAITOK never returns NULL
Needs ReviewPublic

Authored by howard0su_gmail.com on Apr 12 2016, 12:43 AM.
Tags
None
Referenced Files
F173360037: D5922.id15093.diff
Fri, Sep 25, 10:52 AM
F173348482: D5922.diff
Fri, Sep 25, 9:20 AM
Unknown Object (File)
Tue, Sep 22, 3:25 AM
Unknown Object (File)
Mon, Sep 21, 11:07 AM
Unknown Object (File)
Aug 21 2026, 11:17 PM
Unknown Object (File)
Aug 13 2026, 8:04 PM
Unknown Object (File)
Aug 11 2026, 11:21 AM
Unknown Object (File)
Aug 8 2026, 4:45 PM
This revision needs review, but all specified reviewers are disabled or inactive.

Details

Reviewers
• hselasky

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 3225
Build 3258: arc lint + arc unit

Event Timeline

howard0su_gmail.com retitled this revision from to usb: malloc with M_WAITOK never returns NULL.
howard0su_gmail.com updated this object.
howard0su_gmail.com edited the test plan for this revision. (Show Details)

Hi,

In the USB core M_NOWAIT should be used, and NULL checks should be preserved. The NULL checks are active for embedded products (non-FreeBSD) where the malloc implementation does not support M_WAITOK.

--HPS

Hi,

In the USB core M_NOWAIT should be used, and NULL checks should be preserved. The NULL checks are active for embedded products (non-FreeBSD) where the malloc implementation does not support M_WAITOK.

--HPS

So all M_WAITOK should be replaced with M_NOWAIT?

Where there are NULL checks M_NOWAIT is the correct option for malloc(). Else use M_WAITOK.

--HPS