Page MenuHomeFreeBSD

rtw89: Remove an unneeded __DECONST
ClosedPublic

Authored by jhb on Sep 3 2025, 3:25 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Oct 13, 12:41 PM
Unknown Object (File)
Fri, Oct 10, 9:31 PM
Unknown Object (File)
Fri, Oct 10, 9:31 PM
Unknown Object (File)
Fri, Oct 10, 9:30 PM
Unknown Object (File)
Fri, Oct 10, 3:46 PM
Unknown Object (File)
Wed, Sep 24, 1:39 AM
Unknown Object (File)
Tue, Sep 23, 10:55 PM
Unknown Object (File)
Sun, Sep 21, 12:26 PM
Subscribers

Details

Summary

There is no need to use DECONST to when assigning a copy of an enum
value to a local variable of the same type.
DECONST should really
only be used to remove const from pointer types, not scalar values.

Obtained from: CheriBSD
Sponsored by: AFRL, DARPA

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

jhb requested review of this revision.Sep 3 2025, 3:25 PM

I suspect this was added while working on a merge from upstream early in the merge process but then made unnecessary later in the merge process. This raises an error on CheriBSD since the enum value is cast to a uintptr_t and then back to an enum inside of __DECONST and that looks like a cast to a capability from an integer which raises the error.

I'll go and see where that came from tonight; I would normally not add a __DECONST if there wasn't a compiler error.

Good catch Cheri!

In case you want to add to your commit message, maybe add the Fixes
at least.

this seems to be a merge problem when updating the driver to v6.11.
Originally in e2340276fc73 the function argument was a
"const void *data" which we changed to "const int" in FreeBSD.
The Linux version simply cast the const void * to
(enum rtw89_rf_path) both losing the const and changing the type.
When later the function argument became a
const union rtw89_fw_element_arg in 5b760eaecd6c3 it seems we
tried to undo the older FreeBSD specific part and initially
mismerged it leading to the const void *; but when fixing the
type we did not undo the __DECONST but did a mechanical copy.

Fixes: 6d67aabd63555

This revision is now accepted and ready to land.Sep 3 2025, 9:44 PM

Thanks, I will update the commit log.

This revision was automatically updated to reflect the committed changes.