Page MenuHomeFreeBSD

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

Authored by bz on Wed, Nov 24, 7:50 PM.

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
R10 FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

bz requested review of this revision.Wed, Nov 24, 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.Wed, Nov 24, 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.Wed, Nov 24, 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.