Skip to content

Commit ed33fbb

Browse files
elfringchanwoochoi
authored andcommitted
PM / devfreq: event: Call of_node_put() only once in devfreq_event_get_edev_by_phandle()
An of_node_put(node) call was immediately used after a null pointer check for the local variable “edev” at the end of this function implementation. Thus call such a function only once instead directly before the check. This issue was transformed by using the Coccinelle software. Link: https://lore.kernel.org/lkml/0f103384-376c-41f0-a35c-8ad98327d6cb@web.de/ Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
1 parent 40384c8 commit ed33fbb

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

drivers/devfreq/devfreq-event.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -244,13 +244,9 @@ struct devfreq_event_dev *devfreq_event_get_edev_by_phandle(struct device *dev,
244244
edev = NULL;
245245
out:
246246
mutex_unlock(&devfreq_event_list_lock);
247-
248-
if (!edev) {
249-
of_node_put(node);
250-
return ERR_PTR(-ENODEV);
251-
}
252-
253247
of_node_put(node);
248+
if (!edev)
249+
return ERR_PTR(-ENODEV);
254250

255251
return edev;
256252
}

0 commit comments

Comments
 (0)