Page MenuHomeFreeBSD

iicbus: Use device_delete_children() instead of explicit child removal
ClosedPublic

Authored by dumbbell on Oct 17 2015, 2:54 PM.
Tags
None
Referenced Files
F136488649: D3926.id9469.diff
Tue, Nov 18, 12:45 AM
Unknown Object (File)
Sun, Nov 9, 2:39 AM
Unknown Object (File)
Wed, Nov 5, 9:32 AM
Unknown Object (File)
Thu, Oct 30, 7:48 PM
Unknown Object (File)
Sat, Oct 25, 2:30 PM
Unknown Object (File)
Oct 18 2025, 10:12 AM
Unknown Object (File)
Oct 15 2025, 10:29 PM
Unknown Object (File)
Oct 10 2025, 1:14 PM
Subscribers

Details

Summary

If the bus is detached and deleted by a call to device_delete_child() or device_delete_children() on a device higher in the tree, I²C children were already detached and deleted. So the device_t pointer stored in sc points to freed memory: we must not try to delete it again.

The same change is applied to my i915 WIP branch to the i915 driver. This fixes a general protection fault users reported.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 796
Build 796: arc lint + arc unit

Event Timeline

dumbbell retitled this revision from to iicbus: Use device_delete_children() instead of explicit child removal If the bus is detached and deleted by a call to device_delete_child() or device_delete_children() on a device higher in the tree, I²C children were already detached and....
dumbbell updated this object.
dumbbell edited the test plan for this revision. (Show Details)
dumbbell added reviewers: jhb, kib.
dumbbell retitled this revision from iicbus: Use device_delete_children() instead of explicit child removal If the bus is detached and deleted by a call to device_delete_child() or device_delete_children() on a device higher in the tree, I²C children were already detached and... to iicbus: Use device_delete_children() instead of explicit child removal.
jhb edited edge metadata.
This revision is now accepted and ready to land.Oct 19 2015, 9:29 PM
imp added a reviewer: imp.

I like it.

sys/dev/iicbus/iicbus.c
43

Since the only changes to this file are white space, it might be better to do that as a separate commit.

sys/dev/iicbus/iicbus.c
43

Agreed

sys/dev/iicbus/iicbus.c
43

I planned to commit whitespace changes in a separate commit already, even for the other files.

This revision was automatically updated to reflect the committed changes.