Page MenuHomeFreeBSD

Fix ENA driver error handling in attach and basic style fixes
ClosedPublic

Authored by mk_semihalf.com on Oct 31 2017, 1:28 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, May 3, 8:28 PM
Unknown Object (File)
Thu, May 2, 7:42 PM
Unknown Object (File)
Thu, May 2, 7:37 PM
Unknown Object (File)
Thu, May 2, 7:33 PM
Unknown Object (File)
Thu, May 2, 7:29 PM
Unknown Object (File)
Thu, May 2, 7:21 PM
Unknown Object (File)
Thu, May 2, 1:25 PM
Unknown Object (File)
Thu, May 2, 1:25 PM

Details

Summary

The patch contains following changes:

  • In conditional checks, always check for NULL or 0 instead of negating values
  • Use malloc and free explicitely, instead of ENA_MEM_FREE and ENA_MEM_FREE (the dmadev passed to macro is never used, and could be a little misleading)
  • Always check for NULL after calling malloc (few checks were missing)
  • Rework naming of the goto tags in ena_attach() for consistency
  • Fix error handling in ena_attach() - few goto instructions were leading to the wrong tag
  • Destroy MMIO req read request if attach failed
  • Remove checking for NULL after calling malloc with M_WAITOK flag

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

sys/dev/ena/ena.c
793

This can never be NULL since this is a M_WAITOK allocation. Suggest removing this check. BTW, I am assuming M_WAITOK is safe here since it is only called from the control path.

1703

Same comment as line 809 above.

3488

Same comment as line 809 above.

3494

Same comment as line 809 above.

mk_semihalf.com edited the summary of this revision. (Show Details)

Fixes from review:

  • Remove checking for NULL after calling malloc with M_WAITOK flag

Nice cleanup in ena_init_io_rings(). Looks good to me.

This revision is now accepted and ready to land.Nov 2 2017, 5:46 PM