Page MenuHomeFreeBSD

pms/freebsd: fix compiler warnings
ClosedPublic

Authored by rlibby on Oct 16 2017, 6:34 AM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Nov 25, 1:54 PM
Unknown Object (File)
Oct 2 2024, 9:42 PM
Unknown Object (File)
Oct 2 2024, 11:04 AM
Unknown Object (File)
Oct 1 2024, 1:13 AM
Unknown Object (File)
Sep 27 2024, 10:45 AM
Unknown Object (File)
Sep 19 2024, 5:31 AM
Unknown Object (File)
Sep 7 2024, 8:08 AM
Unknown Object (File)
Sep 7 2024, 6:57 AM
Subscribers

Details

Summary
  • A number of unused variable warnings,
  • a missing prototype warning (actually a dead function),
  • and a potential use of an uninitialized variable.

This patch is just for the code under sys/dev/pms/freebsd, which I am assuming we are free to patch and maintain.

I also have a set of patches that would fix the rest of the warnings in pms (outside of pms/freebsd) and actually allow enabling warnings for the module. I assume there is an upstream somewhere, but I haven't been able to find it yet.

Test Plan

buildkernel

Additionally I enabled warnings for pms (after applying those other patches) and ensured a clean build.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Upstream indeed seems to have disappeared but Benno Rice may know better.

sys/dev/pms/freebsd/driver/ini/src/agtiapi.c
2078 ↗(On Diff #34016)

Interesting change. The original code seems to have had some chance for undefined values.

This revision is now accepted and ready to land.Oct 17 2017, 5:34 PM
In D12683#263679, @pfg wrote:

Upstream indeed seems to have disappeared but Benno Rice may know better.

Thanks, I'll ping him.

sys/dev/pms/freebsd/driver/ini/src/agtiapi.c
2078 ↗(On Diff #34016)

Yes, although it looks like in practice pmcsc being NULL would cause us to page fault in agtiapi_GetCCB. This was the straightforward fix for the uninitialized variable warning, but reading further it looks like the pmcsc is never NULL from the only caller, agtiapi_cam_action. Would you like this to be fixed up further to KASSERT(pmcsc != NULL) at the top and then remove the pmcsc != NULL guard altogether?

FWIW, I sent benno some typo fixes long ago but I never heard from him (I'll dig up the patches again) ... the upstream email address is no more.

sys/dev/pms/freebsd/driver/ini/src/agtiapi.c
2078 ↗(On Diff #34016)

I think it's OK as it is, but I have no experience with this driver.

This revision was automatically updated to reflect the committed changes.