Page MenuHomeFreeBSD

uhid_snes: Remove USB_ST_TRANSFERRED handling for the status request.
ClosedPublic

Authored by jhb on Apr 7 2022, 11:08 PM.

Details

Summary

The result of the request computed in new_status was never returned to
the caller leaving new_status as a set-but-unused variable. Removing
new_status leaves sc->previous_status as a write-only variable.
Removing sc->previous_status leaves current_status as a write-only
variable, so it collapses down to removing the entire
USB_ST_TRANSFERRED case.

Arguably, all of the support for UHID_SNES_STATUS_DT_RD should be
removed as it doesn't return anything to the caller. If the request
should be fixed instead then this commit should be reverted and
new_status should be returned to whoever submitted the request.

Diff Detail

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

Event Timeline

jhb requested review of this revision.Apr 7 2022, 11:08 PM

I suspect you can just remove the new_status . I think it is some leftover.

I suspect you can just remove the new_status . I think it is some leftover.

+1

sys/dev/usb/input/uhid_snes.c
517–518

So if I remove new_status I need to remove all of this block I think? Once I remove new_status, then sc->sc_previous_status becomes a write-only variable so I need to remove that. Once I do that, then current_status becomes a write-only variable so then I have to remove that and the rest of the code in this block. I'm fine with doing all that if it is all dead code. However, it begs the question of if this entire function is dead code since the logical request it is associated with seems pointless as it doesn't return the status obtained from the device anywhere?

jhb retitled this revision from uhid_snes: Mark new_status as unused. to uhid_snes: Remove USB_ST_TRANSFERRED handling for the status request..Apr 18 2022, 7:23 PM
jhb edited the summary of this revision. (Show Details)
This revision was not accepted when it landed; it landed in state Needs Review.Apr 18 2022, 7:30 PM
This revision was automatically updated to reflect the committed changes.