Page MenuHomeFreeBSD

LinuxKPI: fix -Wunused-but-set-variable warnings
ClosedPublic

Authored by bz on Nov 24 2021, 7:50 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Apr 8, 2:17 PM
Unknown Object (File)
Feb 9 2024, 7:58 AM
Unknown Object (File)
Dec 23 2023, 1:06 AM
Unknown Object (File)
Dec 12 2023, 6:14 AM
Unknown Object (File)
Nov 27 2023, 12:33 AM
Unknown Object (File)
Nov 8 2023, 8:27 AM
Unknown Object (File)
Oct 31 2023, 3:56 PM
Unknown Object (File)
Oct 28 2023, 12:44 AM
Subscribers

Details

Summary

Handle write-only variables by removing the unused return value from void
functions, removing the unused variables entirely, and in
usb_suspend/resume to now return a possible error to get a printf.

Sponsored by: The FreeBSD Foundation
MFC after: 10 days

Diff Detail

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

Event Timeline

bz requested review of this revision.Nov 24 2021, 7:50 PM

It all looks good. Maybe split the one change in behavior out, or reword commit message to be about that with a "while I'm here kill write only variables" since there are only a few. But the change is good and I'll leave it to your discretion which option to use.

This revision is now accepted and ready to land.Nov 24 2021, 7:55 PM
manu added inline comments.
sys/compat/linuxkpi/common/src/linux_firmware.c
161

Don't we want to do something in case of an error here ?
Looks like this function returns an errno compatible code.

bz marked an inline comment as done.Nov 24 2021, 9:19 PM
In D33107#748142, @imp wrote:

It all looks good. Maybe split the one change in behavior out, or reword commit message to be about that with a "while I'm here kill write only variables" since there are only a few. But the change is good and I'll leave it to your discretion which option to use.

The change in behavior is merely possibly triggering a printf elsewhere to my understanding; there is no real functional change. But splitting it out is easy enough.

sys/compat/linuxkpi/common/src/linux_firmware.c
161

We already print the error given we pass in "warn = true".
In the "nowait" case Linux drivers seem to check "fw" fields to figure out if there is "data" and that's all they care about.
So there is not much else to do here anymore.

The other callers are using the return code of _linuxkpi_request_firmware.

This revision was automatically updated to reflect the committed changes.
bz marked an inline comment as done.