Page MenuHomeFreeBSD

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

Authored by kibab on Jun 19 2018, 8:43 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Nov 14, 9:05 PM
Unknown Object (File)
Thu, Oct 31, 6:35 PM
Unknown Object (File)
Oct 18 2024, 8:15 AM
Unknown Object (File)
Sep 30 2024, 7:12 PM
Unknown Object (File)
Sep 30 2024, 6:07 PM
Unknown Object (File)
Sep 28 2024, 3:01 PM
Unknown Object (File)
Sep 26 2024, 9:05 PM
Unknown Object (File)
Sep 25 2024, 3:27 AM
Subscribers

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

Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 23206
Build 22249: arc lint + arc unit

Event Timeline

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

I'd consider making this a kassert.

823–824

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.

826

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
kibab added inline comments.
sys/cam/mmc/mmc_da.c
823–824
kibab marked an inline comment as done.

addressed reviewer comments

sys/cam/mmc/mmc_da.c
241–243

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.

Address comments from bz@

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.