Page MenuHomeFreeBSD

sys/cam/mmc/mmc_da.c: Refactor error handling
ClosedPublic

Authored by kibab on Jun 19 2018, 8:43 PM.

Details

Summary

There is some code duplication in error handling paths in a few functions.
Create a function for printing such errors in human-readable way and get rid
of duplicates.

Diff Detail

Repository
rS 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

kibab created this revision.Jun 19 2018, 8:43 PM
linimon retitled this revision from Refactor error handling to sys/cam/mmc/mmc_da.c: Refactor error handling.Jul 18 2018, 1:21 PM
imp requested changes to this revision.Jul 18 2018, 10:32 PM

make sure all the places you've put the mmc_handle_reply can handle errno-type errors. There's at least one that can't.

sys/cam/mmc/mmc_da.c
241 ↗(On Diff #44101)

I'd consider making this a kassert.

822 ↗(On Diff #44101)

My brain tells me you still need to check the error here, but reading code suggests we always set the ccb_h.status, so maybe that's OK.

side note: cam_periph_runccb should grow stats support for MMC_IO transactions.

825 ↗(On Diff #44101)

so mmc_handle_reply returns ERRNO type errors. but two lines below, you return MMC_ERR_FAILED. You can't mix and match like that.

This revision now requires changes to proceed.Jul 18 2018, 10:32 PM
bz added a subscriber: bz.Nov 12 2018, 3:12 PM
kibab updated this revision to Diff 55257.Mar 19 2019, 10:52 PM

Sync Arcanist

kibab marked 3 inline comments as done.Mar 19 2019, 11:07 PM
kibab added inline comments.
sys/cam/mmc/mmc_da.c
822 ↗(On Diff #44101)
kibab updated this revision to Diff 55258.Mar 19 2019, 11:10 PM
kibab marked an inline comment as done.

addressed reviewer comments

bz added inline comments.Mar 20 2019, 8:20 AM
sys/cam/mmc/mmc_da.c
241 ↗(On Diff #55258)

I'd (a) line-wrap this at 80, (b) print func_code and possibly the ccb %p in the KASSERT; it makes debugging a lot easier if you hit it.

kibab updated this revision to Diff 55277.Mar 20 2019, 11:46 AM

Address comments from bz@

kibab marked an inline comment as done.Mar 20 2019, 11:47 AM
imp accepted this revision.Apr 1 2019, 6:24 PM
This revision is now accepted and ready to land.Apr 1 2019, 6:24 PM
This revision was automatically updated to reflect the committed changes.