Page MenuHomeFreeBSD

pms/freebsd: fix compiler warnings
ClosedPublic

Authored by rlibby on Oct 16 2017, 6:34 AM.
Tags
None
Referenced Files
F171950267: D12683.id34016.diff
Mon, Sep 14, 9:00 PM
F171949274: D12683.diff
Mon, Sep 14, 8:47 PM
Unknown Object (File)
Sat, Sep 12, 10:21 AM
Unknown Object (File)
Fri, Sep 11, 5:58 PM
Unknown Object (File)
Sat, Sep 5, 12:24 AM
Unknown Object (File)
Fri, Sep 4, 7:59 PM
Unknown Object (File)
Fri, Sep 4, 10:30 AM
Unknown Object (File)
Fri, Sep 4, 9:44 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

Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 12063
Build 12370: arc lint + arc unit

Event Timeline

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

sys/dev/pms/freebsd/driver/ini/src/agtiapi.c
2078

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

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

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.