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)
Jan 13 2024, 2:56 AM
Unknown Object (File)
Dec 20 2023, 6:11 AM
Unknown Object (File)
Dec 17 2023, 4:43 PM
Unknown Object (File)
Nov 8 2023, 10:02 AM
Unknown Object (File)
Sep 2 2023, 2:39 AM
Unknown Object (File)
Jul 4 2023, 8:43 AM
Unknown Object (File)
Jul 4 2023, 8:41 AM
Unknown Object (File)
Jul 4 2023, 8:39 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.