Page MenuHomeFreeBSD

sdhci: refine locking in sdhci_card_task()
AbandonedPublic

Authored by mhorne on Feb 4 2025, 8:25 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Feb 26, 11:02 PM
Unknown Object (File)
Thu, Feb 26, 6:16 PM
Unknown Object (File)
Thu, Feb 26, 8:15 AM
Unknown Object (File)
Thu, Feb 26, 8:03 AM
Unknown Object (File)
Sun, Feb 22, 6:20 AM
Unknown Object (File)
Sun, Feb 8, 2:18 AM
Unknown Object (File)
Jan 31 2026, 5:15 AM
Unknown Object (File)
Dec 20 2025, 5:41 AM
Subscribers
None

Details

Reviewers
imp
manu
Summary

It is invalid to call device_add_child() while holding the driver's
mutex. This was previously of no consequence, but a recent change
to device array allocation (f3d3c63442ff) switched the logic to use
M_WAITOK. Now, a LOR warning is printed when the card is inserted.

Fix this by reducing the scope of the device lock in the helper function
to:

  1. Reading device state (card & child device presence)
  2. Updating device state (after child added/before removed)

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 62259
Build 59143: arc lint + arc unit