Commit f3c7b40
jesd204: core: fix dts overlay handling
When handling the notifications sent by dts overlays, the code was
calling 'of_find_node_with_property()' to look for jesd204 devices. The
typical way to call this is:
```
for (dn = of_find_node_with_property(NULL, prop_name); dn; \
dn = of_find_node_with_property(dn, prop_name))
```
So when we are done with the loop, all nodes are properly handled (i.e:
of_node_put() was called). The problem here is that we first call
'of_find_node_with_property()' with a non NULL 'from' and so
'of_node_put()' will be wrongly called on it (since that node is not
something we really hold a reference for) leading to the following dump
when releasing a dt overlay:
[ 8590.192388] OF: ERROR: Bad of_node_put() on /fragment@0/__overlay__
[ 8590.192410] CPU: 0 PID: 1352 Comm: dtoverlay Tainted: G WC 5.10.63-v7l+ #3
[ 8590.192420] Hardware name: BCM2711
[ 8590.192429] Backtrace:
[ 8590.192468] [<c0ffcedc>] (dump_backtrace) from [<c0ffd250>] (show_stack+0x20/0x24)
[ 8590.192483] r7:ffffffff r6:00000000 r5:60000013 r4:c1ee76fc
[ 8590.192501] [<c0ffd230>] (show_stack) from [<c1001a80>] (dump_stack+0xc4/0xf0)
[ 8590.192519] [<c10019bc>] (dump_stack) from [<c0b9dae8>] (of_node_release+0x120/0x124)
[ 8590.192533] r9:c49b1100 r8:c4fe3020 r7:c5fb0190 r6:c5fb01bc r5:00000000 r4:c5fb01bc
[ 8590.192553] [<c0b9d9c8>] (of_node_release) from [<c07a1470>] (kobject_put+0xb8/0xf8)
[ 8590.192565] r7:00000000 r6:c1f30748 r5:00000000 r4:c5fb01bc
[ 8590.192580] [<c07a13b8>] (kobject_put) from [<c0b9cd40>] (of_node_put+0x24/0x28)
[ 8590.192592] r7:c1f3097c r6:c4fe3000 r5:c4fe3000 r4:00000001
[ 8590.192609] [<c0b9cd1c>] (of_node_put) from [<c0ba2580>] (free_overlay_changeset+0x68/0xa8)
[ 8590.192626] [<c0ba2518>] (free_overlay_changeset) from [<c0ba27f8>] (of_overlay_remove+0x1b8/0x2b8)
...
This change fixes it by refactoring the way we detect jesd204 devices.
Note that with this, the following dts overlay example won't work:
```
__overlay__ {
node1 {
node2 {
jesd204_device;
};
};
};
```
For now this should not be a problem as we don't really have jesd
devices defined in child nodes of a device.
Fixes: b61aebb ("jesd204: jesd204-core: Support for dynamic dt changes")
Signed-off-by: Nuno Sá <[email protected]>
(cherry picked from commit e6f48d8)1 parent 9bf1ca8 commit f3c7b40
1 file changed
+4
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1082 | 1082 | | |
1083 | 1083 | | |
1084 | 1084 | | |
1085 | | - | |
1086 | | - | |
1087 | | - | |
| 1085 | + | |
| 1086 | + | |
| 1087 | + | |
| 1088 | + | |
1088 | 1089 | | |
1089 | 1090 | | |
1090 | 1091 | | |
| |||
0 commit comments