Skip to contentSkip to conversation

BACKPORT: FROMLIST: drm: bridge: fix device_node_continue.cocci warnings (fwd)

PATCH In review Julia Lawall 2 participants 2 messages Jan 6, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 BACKPORT: FROMLIST: drm: bridge: fix device_node_continue.cocci warnings (fwd)

From: kbuild test robot <[email protected]>

Device node iterators put the previous value of the index variable, so an explicit put causes a double put.

Generated by: scripts/coccinelle/iterators/device_node_continue.cocci

Fixes dc857bb84572 ("BACKPORT: FROMLIST: drm: bridge: Generic GPIO mux driver")
CC Nicolas Boichat <[email protected]>

---

Hello,

I'm not sure if the patch is correct. The change on line 213 does look correct. of_node_put is normally not needed before a continue, because the iterator is going to do a put as well. Perhaps the one on line 236 has that property as well, but there is not enough context in the proposed patch to see the issue. In any case, I signed off on the patch in case it turns out to be useful.

julia

tree:   https://chromium.googlesource.com/chromiumos/third_party/kernel chromeos-4.19
head:   8dffe065b46fe2708c6b33ccfebf93c5309d500b
commit: dc857bb845724812ebbe07713be62df11a42e262 [11/12] BACKPORT: FROMLIST: drm: bridge: Generic GPIO mux driver

:::::: branch date: 14 hours ago
:::::: commit date: 14 hours ago

Please take the patch only if it's a positive warning. Thanks!

 generic-gpio-mux.c |    2 --
 1 file changed, 2 deletions(-)
drivers/gpu/drm/bridge/generic-gpio-mux.c +0 -2
@@ -210,7 +210,6 @@ static int gpio_display_mux_probe(struct
 
 	for_each_child_of_node(port, ep) {
 		if (!ep->name || (of_node_cmp(ep->name, "endpoint") != 0)) {
-			of_node_put(ep);
 			continue;
 		}
 
@@ -233,7 +232,6 @@ static int gpio_display_mux_probe(struct
 			of_node_put(port);
 			return -EINVAL;
 		}
-		of_node_put(ep);
 
 		if (of_device_is_compatible(remote, "hdmi-connector")) {
 			of_node_put(remote);
#1 lore raw
Quoted 16 lines · Julia Lawall

From: kbuild test robot <[email protected]>

Device node iterators put the previous value of the index variable, so an explicit put causes a double put.

Generated by: scripts/coccinelle/iterators/device_node_continue.cocci

Fixes dc857bb84572 ("BACKPORT: FROMLIST: drm: bridge: Generic GPIO mux driver")
CC Nicolas Boichat <[email protected]>

---

Hello,

Quoted 9 lines

I'm not sure if the patch is correct. The change on line 213 does look correct. of_node_put is normally not needed before a continue, because the iterator is going to do a put as well. Perhaps the one on line 236 has that property as well, but there is not enough context in the proposed patch to see the issue. In any case, I signed off on the patch in case it turns out to be useful.

julia

Hi Julia,

We have received the kbuild test robot warning and applied a similar fix[1]: remove the 2 of_node_put(). Still many thanks for your patch.

[1] https://chromium.googlesource.com/chromiumos/third_party/kernel/+/73875cded1b03697d0a93257894451e7187a2f54%5E%21/#F0

Hsin-Yi